I need a simple SQL to accomplish the below:
Problem:
When a petrol bunk runs out of fuel, the admin makes note of the DateTime (RunOutDate) when it ran out of fuel and notes also the DateTime (ResupplyDate) when the fuel supply was back on.
I need to create a report on how many days the bunk ran out of fuel.
eg.
1/1/1 10:10 to 1/1/1 10:50 should be counted as 1
1/1/1 10:10 to 2/1/1 07:20 should be counted as 2
1/1/1 23:55 to 2/1/1 00:10 should be counted as 2
I can not bank using hours using DateDiff as 24 hours could have spanned across 2 days.
TIA