Below is an example of an Oracle query getting year & month from a
DATE field, then sorting . In my Sqlite db I am storing my dates as
yyyy_mm_dd values. Would the equivalent be: or is there a better
way?
DB[:tbl].select{ |o| o.created[0..6] }.order( :created ).all
thanks
Eric
SELECT DISTINCT
TO_CHAR ( created, 'YYYY-MM' ) AS month
FROM
tbl
ORDER BY
1 ASC;
month
--------
2006-12
2007-03
2007-08
...
2009-02
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---