mysql-PHP,MYSQL如何根据当前时间查询表中所对应的时间段
程序员文章站
2024-02-10 08:49:40
...
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