3

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 ?!

user265314
  • 33
  • 4

3 Answers3

2

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)
D'Arcy Rittich
  • 167,292
  • 40
  • 290
  • 283
0

use

group by MONTH(record_date)

see this question for more information :

MySQL Query GROUP BY day / month / year

Community
  • 1
  • 1
Haim Evgi
  • 123,187
  • 45
  • 217
  • 223
0
SELECT ... GROUP BY MONTH(datecolumn)
Yada
  • 30,349
  • 24
  • 103
  • 144