Zack Burt
Zack Burt

Reputation: 8455

How to cast DATETIME as a DATE in mysql?

My query is this. I have a bunch of entries and i want to group them by date. But instead of having date in my database, I have a datetime field. What do I do?

select * from follow_queue group by follow_date cast follow_date as date

That's not working.

Upvotes: 105

Views: 209955

Answers (1)

ChssPly76
ChssPly76

Reputation: 100706

Use DATE() function:

select * from follow_queue group by DATE(follow_date)

Upvotes: 205

Related Questions