Reputation: 33
I'm trying to filter time date from a DateTime table to create two separate tables:
I've been able to filter the day-shift using this query:
SELECT
tbLogTimeValues.DateTimeStamp
,tbLogTimeValues.SeqNo
,tbLogTimeValues.FloatVALUE
,tbLogTimeValues.ParentID
,tbLogTimeValues.OdometerValue
FROM tbLogTimeValues
WHERE datepart("hh", tbLogTimeValues.DateTimeStamp) >= 07
AND datepart("hh", tbLogTimeValues.DateTimeStamp) <= 19
but I don't know how to filter for the night-shift.
Upvotes: 2
Views: 186
Reputation: 425458
Use NOT BETWEEN
:
WHERE datepart("hh", tbLogTimeValues.DateTimeStamp) NOT BETWEEN 7 AND 19
Upvotes: 1
Reputation: 1271231
Just change the where
clause to its inverse:
WHERE datepart(hour, tbLogTimeValues.DateTimeStamp) < 07 or
datepart(hour, tbLogTimeValues.DateTimeStamp) > 19
Upvotes: 0