I want to to pick an interval from this records, with this query:
SELECT *
FROM `table`
WHERE camera_id = '4'
AND data BETWEEN '2015-03-29 12:00:01' AND '2015-03-30 11:59:59'
the problem is that, for the intervals from 1 day, eg from 03-29 to 03-30 does not find the record, and for several days working as 03-29 to 03-31
What do I need? NOT find a range of dates to be included in those times to book a room. so if I record with the same prenotazione_id
must give me back empty. if I know that I need a foreach.
SELECT * FROM `table` WHERE camera_id = '4' AND data BETWEEN
DATE_FORMAT('2015-03-29 12:00:01','%Y-%m-%d %h:%i:%s')
AND
DATE_FORMAT('2015-03-29 12:00:01','%Y-%m-%d %h:%i:%s') AS date
您的BETWEEN跳过一秒钟-中午。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.