How to cast DATETIME as a DATE in mysql?

后端 未结 2 1570
一整个雨季
一整个雨季 2020-11-30 01:50

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?



        
相关标签:
2条回答
  • 2020-11-30 01:55

    Use DATE() function:

    select * from follow_queue group by DATE(follow_date)
    
    0 讨论(0)
  • 2020-11-30 02:06

    http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html

    http://www.tutorialspoint.com/mysql/mysql-date-time-functions.htm

    use Date function directly. Hope it works

    0 讨论(0)
提交回复
热议问题