我有一个表,其中包含2列startdate和enddate用于存储特定场所中有趣节目的开始和结束时间(两列的格式为datetime-格式为'Ymd H:i:s')。当用户创建a program within this time limit
或the end time of the program lies within the time limit but not the start time
或时,程序不应插入到显示警报的表中。我已经写过这样的查询,但它不能正常工作。检查输入的日期时间是否在2个日期时间值的范围之内
SELECT * FROM tbl_venue WHERE venue_id='id' AND
((venue_start_datetime BETWEEN 'entered starttime' AND 'entered end time')
AND (venue_stop_datetime BETWEEN 'entered starttime' AND 'entered end time'))
在此先感谢。
>和<业务合作在日期 – DiMono 2013-03-05 15:23:25
@DiMono Hav使用that.but但在某些情况下它并不能完美工作 – Techy 2013-03-05 15:24:07
难道这不取决于列的数据类型是什么?如果它的varchar不会起作用吗?如果你有你的列设置为DATETIME它将工作。 – Keeleon 2013-03-05 15:24:35