您可以在MYSQL中轻松按时间排序,例如
"SELECT * from table WHERE date = 2012-04-29 order by time"
然后MYSQL将从00:00:00开始订购
我的问题是可以告诉MYSQL从06:00:00开始而不是默认。
答案 0 :(得分:1)
您可以尝试此查询:
SELECT *
FROM table
WHERE date = 2012-04-29
AND TIME>= 06:00:00
ORDER BY time;
答案 1 :(得分:0)
SELECT *
FROM table
WHERE date = 2012-04-29
ORDER BY CASE WHEN hour(time) < 6 THEN 1 ELSE 0 END, time;
Stil,我发现更容易出错,日期和时间分开。