I have a table that contains the start times for shift patterns, for example. I have early starters with a shift start defined at 07:00:00 and normal starters at 08:00:00
When someone punches in at 07:45, I want to be able to return the record for normal starters.
Looking around, I thought this was the right query...
SELECT * FROM shiftSets ORDER BY ABS(TIME(shiftStart)-TIME('07:45:00')) ASC LIMIT 1;
However, this returns early starters and not normal starters as desired.
How can I select the closest record to 07:45:00?