我必须使用特定的时间计划检查mysql中的一些时间重叠,例如:
time_plan1 = 2011-06-30, startTime = 09:00:00, finishTime = 10:00:00
time_plan2 = 2011-06-30, startTime = 12:30:00, finishTime = 13:30:00
time_plan3 = 2011-06-30, startTime = 14:00:00, finishTime = 15:30:00
time_plan4 = 2011-06-30, startTime = 17:00:00, finishTime = 18:00:00
和时代
time1 = 2011-06-30, startTime = 08:30:00, finishTime = 10:00:00
time2 = 2011-06-30, startTime = 12:30:00, finishTime = 13:30:00
time3 = 2011-06-30, startTime = 14:00:00, finishTime = 15:00:00
time4 = 2011-06-30, startTime = 16:30:00, finishTime = 19:00:00
所以我必须为每两个时间计划和时间找到时间计划和时间之间的重叠,但我无法指定哪个时间属于哪个时间计划
更新
对于结果,我需要在这种情况下获得属于时间计划的时间总和:time1:1h time2:1h time3:1h time4:1h sum for 2011-06-30:4h