I´ve created a report in SSRS in which I display all Machines volume from last hour:
where IntervalStartDateTime >= dateadd(HOUR, -2, GETDATE())
And IntervalStartDateTime <= dateadd(HOUR, -1, GETDATE())
from last 4 hours:
where IntervalStartDateTime >= dateadd(HOUR, -4, GETDATE())
And IntervalStartDateTime <= dateadd(HOUR, -3, GETDATE())
and from last 8 hours:
where IntervalStartDateTime >= dateadd(HOUR, -8, GETDATE())
And IntervalStartDateTime <= dateadd(HOUR, -7, GETDATE())
And additionaly I would like to display a row for the actual shift --> here I have some problems. There a three shifts. Night Shift: from: 05:45 - 13:45 early shift: from: 13:45 - 21:45 late shift: from : 21:45 - 05:45
Table:
IntervalStartDateTime
2017-03-28 15:30:00.000
2017-03-28 15:30:00.000
2017-03-28 15:30:00.000
2017-03-28 15:30:00.000
2017-03-28 15:30:00.000
How can I get the actual shift value? I am using Microsoft SQL Server Management Studio