I'm working on a project that involves 2 shifts. Parameters are logged throughout each shift, and there are different criteria to be met for each shift. The shifts are 12 hours long. The ua table holds the high and low points for all of the ranges, including start and end times for each shift. There are other criteria, but I can't even get the time range to work at this point so I didn't include those.
The following query returns no records when the where clause is included, but the resultset without the where clause looks like it should - how can I make this work?:
time_on and time_off are both time(7) fields
SELECT ua.userSAlertID AS ID, convert(time(7), GETDATE()) AS currentTime, ua.time_on, ua.time_off,
CASE WHEN (convert(time(7), GETDATE()) BETWEEN ua.time_on AND ua.time_off) THEN 'WIN' ELSE 'FAIL' END AS spork
FROM ...