I have following problem where I have to group different transactions into timeslots. Suppose you have a table with records which contain an entry datetimestamp. These records are created by users (operators) who work in different shifts
Shift 1: 5 - 13h // Shift 2: 13 - 21h // Shift 3: 21 - 5h
Now I want to have a flexible query which rounds the timestamps down to the start time of the shift. Example:
2010-09-08 06:12:00.000 --> 2010-09-08 05:00:00.000
2010-09-08 02:12:00.000 --> 2010-09-07 21:00:00.000
I already tried a few queries using dateadd and datediff but I don't get it to work... Can anybody help? Thanks