2013-05-17 33 views
0

我需要檢查,如果任何工作時間爲datetime之間的工作時間總和刨絲器超過8小時之間計算時間日期時間之間calulate時間。檢查和SQL 2005

的樣本數據:

1. Work time: 07:00 - 17:00 and datetime for checking 06:00-22:00 
Answer: 2 hour 
2. Work time: 13:00 - 23:00 and datetime for checking 06:00-22:00 
Answer: 1 hour (only 1 hour is grater 8 hours and between 06:00-22:00) 
3. Work time: 19:00 - 05:00 and datetime for checking 22:00-06:00 
Answer: 2 hour (only 2 hour is grater 8 hours and between 22:00-06:00) 

任何想法?

回答