Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Querys using past dates

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I want to create a delete query that deletes all the records that are 30 days or older than the current date. The only problem is that i dont know what filter to use for the query, i have tried things like >date()-30 but i cant get it to work. Does anyone know how i can do it?
 
Maybe something like this?

DELETE FROM table WHERE
(TO_DAYS(NOW()) - TO_DAYS(datefield))>30
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top