Home >Database >Mysql Tutorial >mysql-PHP,MYSQL如何根据当前时间查询表中所对应的时间段

mysql-PHP,MYSQL如何根据当前时间查询表中所对应的时间段

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 09:41:361377browse

mysqlphp数据库

SELECT * FROM my_date;

ID START_DATE END_DATE VAL
1 00:00:00 06:00:00 0.5
2 06:00:00 20:00:00 11
3 20:00:00 00:00:00 99
如上图所示,要如何查询当前时间所匹配的行?

SELECT * FROM my_date WHERE (start_date>CURTIME() and end_date现在的时间是 17:31,为什么这样返回的数据ID为3,不应该是2吗

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn