I want to select data from 6PM to 6AM for the last one week
my Date is in yyyy-mm-dd hh-mm-ss format
I tried this query:
SELECT *
FROM [myview]
where CONVERT(VARCHAR(8),myDate,108) between '18:00:00' and '6:00:00'
and myDate >= DATEADD(DAY,-7,GETDATE()) and myDate <=GETDATE()
This does not seem to work.
It is displaying data for the last seven days but only from 18:00:00 to 23:59:59
I do not see anything from 12:00:00am to 6:00:00am.