I want to modify my Where
clause in my SQL Server Query
below so that it would select ALL records from the previous month.
Example: if I run the query on 20 Feb, it should extract data for 1 Jan to 31 Jan
I have tried using the following but as you may notice, it picks up the records a month back from the day of execution.
WHERE date_col >= cast(dateadd(Month, -1, getdate()) as date) and
date_col <= cast(getdate() as date)