A simple way to do this is to truncate the date and then GROUP BY it. So if 
you have 2009-08-08, and you want a subset on month, then just truncate the 
day-part: 2009-08-00 on the whole column, and SELECT DISTINCT so you have a 
subset. You can use this subset then to join the dates, GROUP BY and 
aggregate....

An other way I found is described in Celko's 'SQL for smarties'. He uses 
modulo there. It seems powerful, but also tricky to implement for dates.

I was wondering if anyone knew some other way to create a subset of a 
timestamp column. Any input is welcome.

Regards,
Davor



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to