How to cast DATETIME as a DATE in mysql?

MysqlDatetimeDate

Mysql Problem Overview


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.

Mysql Solutions


Solution 1 - Mysql

Use DATE() function:

select * from follow_queue group by DATE(follow_date)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionZack BurtView Question on Stackoverflow
Solution 1 - MysqlChssPly76View Answer on Stackoverflow