• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Attack Database

Dogrinha

New Member
Joined
Oct 6, 2019
Messages
206
Solutions
1
Reaction score
2
People tried to invade my website and created a lot of accounts without any character, How do i do to delete all the accounts that doesn't have any character?
TFS 0.4
 
Solution
[PS: the query is based on the schema of tfs 1.X]

players table is linked to accounts with a foreign key attached to the column (account_id), so to workaround this, we want to check if the count of players with an account_id x = 0, that generates a list at which we can iterate to delete them.

How do I know the count of players based on the account id [which is loaded from accounts table]?
SELECT `accounts`.`id`, (select COUNT(*) from `players` WHERE `players`.`account_id` = `accounts`.`id`) as `players_count` FROM `accounts`

To delete these accounts based on this criteria:
DELETE FROM `accounts` WHERE (select COUNT(*) from `players` WHERE `players`.`account_id` = `accounts`.`id`) =...
Gesior, I'd like to know the command to exclude all the accounts that didn't create any character (Don't delete the characters that have an account, but the accounts that don't have any character)
 
[PS: the query is based on the schema of tfs 1.X]

players table is linked to accounts with a foreign key attached to the column (account_id), so to workaround this, we want to check if the count of players with an account_id x = 0, that generates a list at which we can iterate to delete them.

How do I know the count of players based on the account id [which is loaded from accounts table]?
SELECT `accounts`.`id`, (select COUNT(*) from `players` WHERE `players`.`account_id` = `accounts`.`id`) as `players_count` FROM `accounts`

To delete these accounts based on this criteria:
DELETE FROM `accounts` WHERE (select COUNT(*) from `players` WHERE `players`.`account_id` = `accounts`.`id`) = 0

Sincerely,
Slavi
 
Solution
Code:
DELETE FROM accounts a LEFT JOIN players p ON a.id = p.account_id WHERE p.account_id IS NULL AND a.premdays = 0 AND a.premium_points = 0
 
Back
Top