如何将DATETIME作为DATE在mysql中进行转换? [英] How to cast DATETIME as a DATE in mysql?
本文介绍了如何将DATETIME作为DATE在mysql中进行转换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的查询是这样的。我有一堆条目,我想按日期分组。但是,在我的数据库中没有日期,我有一个datetime字段。我该怎么办?
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
这不行。
谢谢!
推荐答案
使用 DATE()
功能:
select * from follow_queue group by DATE(follow_date)
这篇关于如何将DATETIME作为DATE在mysql中进行转换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文