我要檢查一些時間與特定時間的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
,所以我必須找時間計劃之間的重疊和時間爲每對夫婦的時間計劃和時間,但我不能指定哪個時間屬於哪個時間計劃
更新
的結果,我需要有時間的總和那些屬於時間在這種情況下,計劃 : 時間1:1 H 時間2:1 H 時間3:1 H 時間4:1 H 總和2011-06-30:4h中
救你嘗試過什麼? –
是的!但沒有幸運。 「select * *** WHERE time1.startTime> time_plan1.startTime和time1.finishTime
您可以顯示數據如何被拉出/存儲嗎? –