[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`) =...