We, as most vBulletin Forums, end up with new members who never return and have never posted. I call them 'drive-by registrants'. I already have an SQL Query I use to identify them:
I change the value in (unix_timestamp() - (86400 * 730)) to reflect 'number of years', so:
1=365 2=730 3=1095 4=1460 5=1825 6=2190 7=2555 8=2920 9=3285 10=3650
Currently, using 730 (2 years), there are 100 such members. Using higher values, there are none.
I want to utilize an SQL Query to delete these users and have written this:
As this is a permanent action, I'd like a qualified review of what I've written, letting me know if it's okay.
Code:
select username, posts, usergroupid, from_unixtime(joindate), from_unixtime(lastvisit) from user where lastvisit = joindate and lastvisit < (unix_timestamp() - (86400 * 730)) and posts = 0 and usergroupid = 2 order by from_unixtime(lastvisit);
1=365 2=730 3=1095 4=1460 5=1825 6=2190 7=2555 8=2920 9=3285 10=3650
Currently, using 730 (2 years), there are 100 such members. Using higher values, there are none.
I want to utilize an SQL Query to delete these users and have written this:
Code:
delete from user where lastvisit = joindate and lastvisit < (unix_timestamp() - (86400 * 730)) and posts = 0 and usergroupid = 2;



Comment