user265314
user265314

Reputation: 33

date change in sql

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

Upvotes: 3

Views: 118

Answers (3)

D'Arcy Rittich
D'Arcy Rittich

Reputation: 171371

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)

Upvotes: 2

Yada
Yada

Reputation: 31225

SELECT ... GROUP BY MONTH(datecolumn)

Upvotes: 0

Haim Evgi
Haim Evgi

Reputation: 125456

use

group by MONTH(record_date)

see this question for more information :

MySQL Query GROUP BY day / month / year

Upvotes: 0

Related Questions