hi I have a date which is 2009-06-02 00:00:00.000 and i want to only group by month ..
how can change it ?!
hi I have a date which is 2009-06-02 00:00:00.000 and i want to only group by month ..
how can change it ?!
use
group by MONTH(record_date)
see this question for more information :
http://stackoverflow.com/questions/508791/mysql-query-group-by-day-month-year
You may want to group by month, but have data that spans more than one year. In that case, I would do:
group by Year(MyDate), Month(MyDate)
GROUP BY MONTH(yourdate)
Also check out Date and Time Function: Month