I want to use BETWEEN clause in this query and don't know how to do this
SELECT * FROM record
WHERE (DATEPART(yy, register_date) = 2009
AND DATEPART(mm, register_date) = 10
AND DATEPART(dd, register_date) = 10)
I want to use BETWEEN clause in this query and don't know how to do this
SELECT * FROM record
WHERE (DATEPART(yy, register_date) = 2009
AND DATEPART(mm, register_date) = 10
AND DATEPART(dd, register_date) = 10)
This gives the records from 5 hours ago until now
SELECT * FROM record
WHERE register_date BETWEEN DATEADD(HOUR, -5, GETDATE()) AND GETDATE()
It appears this might be what you want
select * from record
where register_date between '2017-10-1' and '2017-12-31'
Do note that if you want all records from the last day you might want to add time or pick the day after as the default time is 0:00