NancyJ
02-09-2008, 06:34 PM
I want to delete any contests that haven't been run in the last 90 days.
I have a table of contests and a table of contest times
This is the query
SELECT * FROM contests c
where active = 0
having
(select max(datetime) from contest_times
where c.id = contest_times.id) < date_sub(CURDATE(), interval 90 day)
Bonus question - how do I convert that into a delete
I have a table of contests and a table of contest times
This is the query
SELECT * FROM contests c
where active = 0
having
(select max(datetime) from contest_times
where c.id = contest_times.id) < date_sub(CURDATE(), interval 90 day)
Bonus question - how do I convert that into a delete