>I have a table which contains 291000 records. This represents the non working hours. That includes holidays, weekends and overnight hours. Those timeframes should not be considered for a specific calculation I need to perform.
>
>The non working hours table contains a start time and an end time.
>
>So, basically, if I have two transactional dates in a table such as 01/10/2014 08:00:00 and 15/10/2014 17:53:24, I need to use this time table to calculate how many working hours applied between these two dates.
>
>This is done by querying the time table and summarizing differentials.
>
>So far, I have converted a logic from an old code. But, that is very deprecated. There has to be something better, such as a single SQL select that would be capable of returning the duration in hours and/or days.
>
>Anyone has ever done something like that or would be able to provide a SQL select example of how you would see it?
Could you post some example data and desired result from it?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.