Finding the Shift for current hour
Hi Hugo Kornelis,
Thank you very much for your reply. The query is working fine. However, I
had to make one change in my data since the query failed on one condition.
Since I was only interested in "time" part, I had not looked properly into
the "date" part. When I insert rows for the given shift information, the
"date" part defaults to '1899-12-30'. I am not sure why this is so, since the
base date is supposed to be '1900-01-01'.
If you look at Shift B, it starts from 6 PM - 6AM. Now if '1899-12-30' is
supposed to be by "base date" for this table, 6 AM represents 6 AM of
'1899-12-31'. So made that change in the table and your query is working
fine. Before this change, if my @EventMoment was '18:10:00', there were no
rows returned.
Once again thanks for you help.
--Pradeep
|