David Brierton David Brierton - 1 year ago 77
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 Source

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())
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download