I have a DB with a table which has a column datetime Date_Time. The format of this is for example: 2021-09-01 13:15:16. I would like to set a query that is indipendent of the time but just consider the date. For example, given such table:
Date_Time
2021-09-01 13:15:16
2021-09-01 10:25:12
2021-08-30 03:05:16
2021-08-29 13:15:16
...
I would like to run a query like:
SELECT Date_Time
FROM dbo.Twitter
WHERE Date_Time BETWEEN '2021-08-29' AND '2021-09-01'
ORDER BY Date_Time DESC;
such query gives me nothing of course since in the BETWEEN there is no hour specified.
The desired result must be what you see above, thus all the rows from '2021-08-29 00:00:00' and '2021-09-01 23:59:59' I tried to impose myself the hours 00:00:00 and 23:59:59 in the BETWEEN command but since there are no record with that time it returns nothing.
The query should return all the result with that date whatever the hour.