Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2016-06-06 09:41:36
Original
1312 people have browsed it

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吗

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!