选择仅比MySQL表中给定日期大一天的时间

时间:2019-08-26 16:58:55

标签: mysql sql

我在MySQL数据库中有一个表,其加载方式如下:

enter image description here

现在,我只需要选择一个大于或等于给定数据的日期级别。例如,如果给定为11/13/2019,则只需要具有11/14/2019的所有行,如:

enter image description here

如果给定为11/15/2019,则仅返回11/16/2019,如

enter image description here

我的日期并非总是按实际日期格式列出。如您所见,11/14/201911/16/2019之间存在间隙,并且11/15/2019丢失了,因此我无法通过在给定的数字后添加数字来使用MySQL中的BETWEEN键在每个选择查询上。

1 个答案:

答案 0 :(得分:2)

我想你想要

select t.*
from t
where t.date = (select min(t2.date)
                from t t2
                where t2.date > ?  -- the date you care about
               );