开发者

MySQL WHERE statement for finding expiry date within 2 days

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜