表中有两个字段serviceDatedate,serviceTimetime来表示时间,怎么查询某个时间段内的数据?
SELECT * FROM idas_service_log t WHERE
AND t.serviceDate >=”2015-09-21″ AND t.`serviceTime` >= “10:26:54″
AND t.`serviceDate`<=”2015-09-30” AND t.`serviceTime` <= “11:26:54”
本人这样写是不对的,求高手指点。
SELECT * FROM idas_service_log t WHERE
AND t.serviceDate >=”2015-09-21″ AND t.`serviceTime` >= “10:26:54″
AND t.`serviceDate`<=”2015-09-30” AND t.`serviceTime` <= “11:26:54”
本人这样写是不对的,求高手指点。
解决方案
10
将这两个字段拼接下,然后转化为时间格式,之后比较
35
SELECT * FROM idas_service_log WHERE CONCAT(serviceDate," ", serviceTime) >= "2015-09-21 10:26:54" AND CONCAT(serviceDate," ", serviceTime) < "2015-09-30 11:26:55"
5
看来可以结贴了