Use the DATEDIFF
function with a datepart of day
.
SELECT ...
FROM ...
WHERE DATEDIFF(day, date1, date2) >= 0
Note that if you want to test that date1
<= date2
then you need to test that DATEDIFF(day, date1, date2) >= 0
, or alternatively you could test DATEDIFF(day, date2, date1) <= 0
.