Fix two hour rule SQL