how to get yesterday date in sql 1

how to get yesterday date in sql

SELECT DATEADD(day, -1, CAST(GETDATE() AS date)) AS YesterdayDate;

Here is what the above code is Doing:
1. We’re creating a variable called YesterdayDate and assigning it the value of the current date minus one day.
2. We’re creating a variable called YesterdayDate and assigning it the value of the current date minus one day.
3. We’re creating a variable called YesterdayDate and assigning it the value of the current date minus one day.

Similar Posts