MySQL 选择日期等于今天

2021-11-20 00:00:00 mysql

我正在尝试运行一个 mysql select 语句,它查看今天的日期,并且只返回当天注册的结果.我目前尝试了以下方法,但似乎不起作用.

I'm trying to run a mysql select statement where it looks at today's date and only returns results that signed up on that current day. I've currently tried the following, but it doesn't seem to work.

SELECT users.id, DATE_FORMAT(users.signup_date, '%Y-%m-%d') 
    FROM users 
    WHERE users.signup_date = CURDATE()

我已经修改了我的 SELECT 语句,谢谢大家.

I've modified my SELECT statement to this, thanks guys.

SELECT id FROM users WHERE DATE(signup_date) = CURDATE()

推荐答案

SELECT users.id, DATE_FORMAT(users.signup_date, '%Y-%m-%d') 
FROM users 
WHERE DATE(signup_date) = CURDATE()

相关文章