MySQL 查询获取特定日期的行

标签 mysql

身份证号|开始     |完
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/

相关文章:

PHP/MySQL 插入空值

php - 发布循环数据,然后使用 PDO 保存

mysql - Mysql Query Plan是如何生成的?

mysql - 无法在 Linux (CentOS) 上安装 "mysql2"gem

mysql - 列作为与另一列连接的行

php - UTF-8贯穿始终

php - 为什么php不在mysql中存储数据?

php - 标记约定

c# - 异常 : There is already an open DataReader associated with this Connection which must be closed first

mysql - 查找最近 5 天的日期和时间