开发者

MySQL WHERE statement for finding expiry date within 2 days

开发者 https://www.devze.com 2023-03-17 03:13 出处:网络
I have a column named ex开发者_开发知识库piry which holds the expiry date of the item in timestamp format.

I have a column named ex开发者_开发知识库piry which holds the expiry date of the item in timestamp format.

How would I execute a MySQL query to only select items with an expiry date within 2 days?

Thanks!!


SELECT * FROM table WHERE expiry BETWEEN(TODAY(), TODAY() + 2)


SELECT * FROM table WHERE DATEDIFF(expire, NOW()) <= 2;


select * from mytable
where expiry between now() and adddate(now(), INTERVAL 2 DAY);


SELECT ...
WHERE expiry <= NOW()+"2 days";


WHERE dateCol <= date_sub(now(), interval 2 day);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号