身份证号|开始 |完
1 | 2016年4月13日 | 2016-04-14
2 | 2016年4月13日 | 2016-04-15
3 | 2016年4月13日 | 2016-04-15
4 | 2016年4月13日 | 2016-04-16
5 | 2016年4月13日 | 2016-04-19
我需要获取 2016-04-16 的事件。所以结果应该是
4 | 2016年4月13日 | 2016-04-16
5 | 2016年4月13日 | 2016-04-19
mysql 查询是什么?
最佳答案
使用和
:
select *
from mytable
where starts <= '2016-04-16' and '2016-04-16' <= ends;
或之间<
:
select *
from mytable
where '2016-04-16' between starts and ends;
关于MySQL 查询获取特定日期的行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36606280/