>Could you post some example data and desired result from it?
For example, if my start and end time is 23/01/2014 09:15:00 and 29/01/2014 13:45:00, the SQL select might return a set of records like this for specific working shifts:
23/01/2014 08:00:00 - 23/01/2014 12:00:00
23/01/2014 13:00:00 - 23/01/2014 17:00:00
24/01/2014 08:00:00 - 24/01/2014 12:00:00
24/01/2014 13:00:00 - 24/01/2014 17:00:00
27/01/2014 08:00:00 - 27/01/2014 12:00:00
27/01/2014 13:00:00 - 27/01/2014 17:00:00
28/01/2014 08:00:00 - 28/01/2014 12:00:00
28/01/2014 13:00:00 - 28/01/2014 17:00:00
29/01/2014 13:00:00 - 29/01/2014 17:00:00
That could represent, for example, Thursday, Friday, Monday, Tuesday and Wednesday afternoon, assuming Wednesday morning was a holiday.
Those would have been selected because they fit within the range of the start and end dates.
So, here, I need to obtain 32.00 hours because this is the total amount of working hours that were eligible between the two dates.
If the start and end time would be 23/01/2014 09:20:00 and 29/01/2014 13:45:00, that would give 31.95 hours.