How can you get today's date and convert it to 01/mm /yyyy
format and get data from the table with delivery month 3 months ago? Table already contains delivery month as 01/mm/yyyy
.
How can you get today's date and convert it to 01/mm /yyyy
format and get data from the table with delivery month 3 months ago? Table already contains delivery month as 01/mm/yyyy
.
SELECT *
FROM TABLE_NAME
WHERE Date_Column >= DATEADD(MONTH, -3, GETDATE())
Mureinik's suggested method will return the same results, but doing it this way your query can benefit from any indexes on Date_Column
.
or you can check against last 90 days.
SELECT *
FROM TABLE_NAME
WHERE Date_Column >= DATEADD(DAY, -90, GETDATE())