[Solved] I have a query with a between clause that is return wrong days [closed]
Let’s break this down: WHERE convert(varchar(10),F_Presence.ts, 120) between ‘2022-03-01’ and ‘2022-03-02’ Converting the column to a string means you will never, ever, ever be able to take advantage of an index on that column, whether it exists yet or not. Using BETWEEN is horrible for date ranges for multiple reasons. Using a format like YYYY-MM-DD … Read more