This is my query
SELECT TIME_FROM, TIME_TO,CASEWHEN W_CODE ='AAU'AND TEAM_CODE <>'AU'THEN1ELSE0ENDAS INLIER,CASEWHEN W_CODE <>'AAU'AND TEAM_CODE ='AU'THEN1ELSE0ENDAS OUTLIERFROM dbo.vwTOPASWardMovements
This is my current output
How can I extract the rows where '2013-25-07 10:00:00:000' is between TIME_FROM and TIME_TO?
For my final outcome I need a sum of inliers and outliers who where in hospital at 10am on the 25th July 2013, and then a seperate column for 26th July 2013, through to 2nd August.
INLIERS OUTLIERS
25TH JULY @ 10 AM 45 86
26TH JULY @ 10 AM 34 243
27TH JULY @ 10 AM 83 233
...THROUGH TO 2ND AUGUST