eJay Posted July 7, 2013 Group: Members Topic Count: 80 Topics Per Day: 0.02 Content Count: 325 Reputation: 76 Joined: 03/22/12 Last Seen: August 5, 2019 Share Posted July 7, 2013 I would like to delete their account if player is not active for almost 5 months using SQL script. Quote Link to comment Share on other sites More sharing options...
Skorm Posted July 7, 2013 Group: Forum Moderator Topic Count: 33 Topics Per Day: 0.01 Content Count: 1282 Reputation: 393 Joined: 02/03/12 Last Seen: Sunday at 10:43 PM Share Posted July 7, 2013 (edited) Here's a quick and easy solution. DELETE FROM `login` WHERE `lastlogin` < (CURRENT_TIMESTAMP - interval '5' month) Although I do have to ask do you mean players not active for 5 months or a range of players from 4th months to the 5th month of inactivity, because from the way your sentence is worded it's hard to tell. Stydianx's post reminded me that you have to delete characters to... but there is also a bunch of other information to delete. CREATE TEMPORARY TABLE TmpTable AS (SELECT `account_id`,`char_id` FROM `char` WHERE `account_id` IN (SELECT `account_id` FROM `login` WHERE `lastlogin` < (CURRENT_TIMESTAMP - interval '5' month))); #Add tables to delete from here. DELETE FROM `guild` WHERE `char_id` IN (SELECT `char_id` FROM TmpTable); DELETE FROM `skill` WHERE `char_id` IN (SELECT `char_id` FROM TmpTable); DELETE FROM `quest` WHERE `char_id` IN (SELECT `char_id` FROM TmpTable); DELETE FROM `mercenary_owner` WHERE `char_id` IN (SELECT `char_id` FROM TmpTable); DELETE FROM `auction` WHERE `seller_id` IN (SELECT `char_id` FROM TmpTable); DELETE FROM `mercenary` WHERE `char_id` IN (SELECT `char_id` FROM TmpTable); DELETE FROM `memo` WHERE `char_id` IN (SELECT `char_id` FROM TmpTable); DELETE FROM `inventory` WHERE `char_id` IN (SELECT `char_id` FROM TmpTable); DELETE FROM `hotkey` WHERE `char_id` IN (SELECT `char_id` FROM TmpTable); DELETE FROM `cart_inventory` WHERE `char_id` IN (SELECT `char_id` FROM TmpTable); DELETE FROM `homunculus` WHERE `char_id` IN (SELECT `char_id` FROM TmpTable); DELETE FROM `friends` WHERE `char_id` IN (SELECT `char_id` FROM TmpTable); DELETE FROM `global_reg_value` WHERE `char_id` IN (SELECT `char_id` FROM TmpTable); DELETE FROM `elemental` WHERE `char_id` IN (SELECT `char_id` FROM TmpTable); DELETE FROM `pet` WHERE `account_id` IN (SELECT `account_id` FROM TmpTable); DELETE FROM `party` WHERE `leader_id` IN (SELECT `account_id` FROM TmpTable); DELETE FROM `guild_member` WHERE `account_id` IN (SELECT `account_id` FROM TmpTable); DELETE FROM `sc_data` WHERE `account_id` IN (SELECT `account_id` FROM TmpTable); DELETE FROM `storage` WHERE `account_id` IN (SELECT `account_id` FROM TmpTable); DELETE FROM `char` WHERE `account_id` IN (SELECT `account_id` FROM TmpTable); DELETE FROM `login` WHERE `account_id` IN (SELECT `account_id` FROM TmpTable); DELETE FROM `login` WHERE `lastlogin` < (CURRENT_TIMESTAMP - interval '5' month); DROP TABLE TmpTable; Will delete all accounts that haven't logged in for less than 5 months. Edited July 7, 2013 by Skorm 3 Quote Link to comment Share on other sites More sharing options...
stydianx Posted July 7, 2013 Group: Members Topic Count: 105 Topics Per Day: 0.02 Content Count: 390 Reputation: 27 Joined: 07/12/12 Last Seen: October 24, 2022 Share Posted July 7, 2013 (edited) go to your PhpAdmin, then go to your Main_db (the sql db of your server) go to char then delete "ALL" characters that belongs to the account. then go to login (can also be found on Main_db) then look for the account you want to delete, when you see it, hit "delete". done. NOTE: A character is tied to a number i.e: Main_db > char 2000097 username password F [email protected] groupid Main_db > login char_id 2000097 char_num charactername class baselevel Edited July 7, 2013 by stydianx Quote Link to comment Share on other sites More sharing options...
eJay Posted July 17, 2013 Group: Members Topic Count: 80 Topics Per Day: 0.02 Content Count: 325 Reputation: 76 Joined: 03/22/12 Last Seen: August 5, 2019 Author Share Posted July 17, 2013 Thanks i'll try this Quote Link to comment Share on other sites More sharing options...
Question
eJay
I would like to delete their account if player is not active for almost 5 months
using SQL script.
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.