Delete Ads over a Year Old.

DELETE FROM banners WHERE EXISTS(SELECT id FROM members WHERE members.lastlogin<‘2016-06-22’ AND members.userid = banners.userid);

DELETE FROM buttons WHERE EXISTS(SELECT id FROM members WHERE members.lastlogin<‘2016-06-22’ AND members.userid = buttons.userid);

DELETE FROM hotlinks WHERE EXISTS(SELECT id FROM members WHERE members.lastlogin<‘2016-06-22’ AND members.userid = hotlinks.userid);

DELETE FROM tlinks WHERE EXISTS(SELECT id FROM members WHERE members.lastlogin<‘2016-06-22’ AND members.userid = tlinks.userid);

DELETE FROM loginads WHERE EXISTS(SELECT id FROM members WHERE members.lastlogin<‘2016-06-22’ AND members.userid = loginads.userid);

 

Thanks to Dave Mosher and Roger Hoover

See Dave’s sites, and the best selection of SuperNetwork bargains anywhere:
>>>> SimpleTextAdz

Roger Hoover is probably the best tech I’ve found for safelists and PHP programming
>>>> http://hoover-usa.com/