I would like to retrieve the previous date (i.e., current date minus 1) and use it in a query through an = operator.
I got the following query to retrieve the previous date:
select DATEADD(DD, DATEDIFF(DY, 0, GETDATE()), -1) It gives: 2011-03-14 00:00:00.000
I would like to get only: 2011-03-14, and use this in a query to check against a column's data.
select * from table where column1 in ('values list') and date=(previous_date) How can I combine the two and get it in the format I want?