我需要有一个历史列表,它只显示今天小于或等于的日期,以及小于此时间的时间。
SELECT
*
FROM
schedules
LEFT JOIN
(special_details
LEFT JOIN
schedule_logs
ON
special_details.id = special_details_id)
ON
schedules.id = location_id
WHERE
location_id = 146
AND date(dates) < ('2013-02-19')
//this will check if schedule is lessthan the date and time for today.
//and its not working...
AND (WHERE
date(dates) = ('2013-02-19')
AND
date(end_time) < ('12:56:20'))
如果日期和时间是2013-02-19 / 11:00:00,则应该出现 如果不出现2013-02-19 / 1:00:00 但是如果它出现在2013-02-18 / 1:00:00,它应该小于今天的日期。
如果您对HISTORY列表有更好的了解,请告诉我。或添加链接。
答案 0 :(得分:0)
试试这个:
SELECT
*
FROM
schedules
LEFT JOIN
(special_details
LEFT JOIN
schedule_logs
ON
special_details.id = special_details_id)
ON
schedules.id = location_id
WHERE
location_id = 146
AND (
date(dates) < ('2013-02-19')
OR
(date(dates) = ('2013-02-19') AND date(end_time) < ('12:56:20')
)