我在使用以下查询在MySql中查找某些记录时遇到问题
select
dletterdate,
days,
date_add(dletterdate,interval days day) as added ,
now() as todaysdate, datediff(now(),date_add(dletterdate,interval days day)) as difference
from mandereports
实际上我想只显示差异小于零的记录。这是输出的屏幕截图:
答案 0 :(得分:0)
您可以使用WHERE
子句。
select
dletterdate,
days,
date_add(dletterdate,interval days day) as added ,
now() as todaysdate, datediff(now(),date_add(dletterdate,interval days day)) as difference
from mandereports
where difference < 0
希望这有帮助