David Brierton David Brierton - 6 months ago 10
SQL Question

SQL Filtering a date grabbing column and having it grab 10 days previous of record

I am trying to figure out how to query a database and go back 10 days from a certain date column. I am using SQL Server 2012.

Where Date_Complete IS (10 days ago or newer)


Any help with this would be greatly appreciated!

Answer

Did you mean this

WHERE Date_Complete >= DATEADD(day,-10, yourdatecolumn)

If you want to consider the time from today then it'd be

WHERE Date_Complete >= DATEADD(day,-10, GETDATE())