如何仅从 MySQL 的 DATETIME 字段中选择日期?

2021-11-20 00:00:00 date mysql

我在 MySQL 数据库中有一个使用 DATETIME 设置的表.我只需要在此表中 SELECT 仅按 DATE 并排除时间.

I have a table in the MySQL database that is set up with DATETIME. I need to SELECT in this table only by DATE and excluding the time.

如何在此表中仅按日期并绕过时间SELECT,即使该特定列设置为 DATETIME?

How do I SELECT in this table by only date and bypassing the time, even if that specific column is set to DATETIME?

现在是:2012-01-23 09:24:41

我只需要为此做一个 SELECT:2012-01-23

I need to do a SELECT only for this: 2012-01-23

推荐答案

SELECT DATE(ColumnName) FROM tablename;

更多关于 MySQL DATE()函数.

相关文章