搜索日期MySql

时间:2015-05-31 11:23:15

标签: mysql sql

我的MySql表'a'中有一行,其值为'date'='2015-06-01''hour' = 17:00:00

我的问题是我可以通过

选择这一行
hour BETWEEN "16:30:00" AND "17:30:00"

但我不能date = 2015-06-01

我需要这样的完整陈述:

SELECT * FROM `a` 
WHERE (date = 2015-06-01)
AND (hour BETWEEN "16:30:00" AND "17:30:00")

1 个答案:

答案 0 :(得分:0)

你需要在日期周围引用

SELECT * FROM `a` 
WHERE `date` = '2015-06-01'
AND `hour` BETWEEN '16:30:00' AND '17:30:00'