whаtеvеr 24 Опубликовано 22 июля, 2012 Помогите написать SQL запрос для удаления всех персонажей,содержимого ими.Кланов\замков у кланов. Делают вот этот запрос.Толку 0 Скрытый текстUPDATE characters SET online=0;DELETE FROM characters WHERE lastAccess < 1191211200; DELETE FROM accounts WHERE lastactive < 1191211200; DELETE FROM characters WHERE level < 75; DELETE FROM characters WHERE account_name NOT IN (SELECT login FROM accounts); DELETE FROM accounts WHERE login NOT IN (SELECT account_name FROM characters); DELETE FROM clan_data WHERE leader_id NOT IN (SELECT obj_Id FROM characters); DELETE FROM clan_privs WHERE clan_id NOT IN (SELECT clan_id FROM clan_data); DELETE FROM clan_subpledges WHERE clan_id NOT IN (SELECT clan_id FROM clan_data); DELETE FROM clan_wars WHERE clan1 NOT IN (SELECT clan_id FROM clan_data); DELETE FROM clan_wars WHERE clan2 NOT IN (SELECT clan_id FROM clan_data); DELETE FROM auction_bid WHERE bidderId NOT IN (SELECT clan_id FROM clan_data); DELETE FROM clanhall_functions WHERE hall_id NOT IN (SELECT ID FROM clanhall WHERE ownerId <> '0'); UPDATE clanhall SET paidUntil='0' WHERE ownerId NOT IN (SELECT clan_id FROM clan_data); UPDATE clanhall SET ownerId='0' WHERE ownerId NOT IN (SELECT clan_id FROM clan_data); DELETE FROM account_data WHERE account_name NOT IN (SELECT login FROM accounts); DELETE FROM account_data WHERE account_name NOT IN (SELECT account_name FROM characters); DELETE FROM account_data WHERE value NOT IN (SELECT obj_Id FROM characters); DELETE FROM items WHERE loc <> 'clanwh' and owner_id NOT IN (SELECT obj_Id FROM characters); DELETE FROM items WHERE loc = 'clanwh' and owner_id NOT IN (SELECT clan_id FROM clan_data); DELETE FROM character_skills WHERE char_obj_id NOT IN (SELECT obj_Id FROM characters); DELETE FROM character_skills_save WHERE char_obj_id NOT IN (SELECT obj_Id FROM characters); DELETE FROM character_shortcuts WHERE char_obj_id NOT IN (SELECT obj_Id FROM characters); DELETE FROM character_recipebook WHERE char_id NOT IN (SELECT obj_Id FROM characters); DELETE FROM character_quests WHERE char_id NOT IN (SELECT obj_Id FROM characters); DELETE FROM character_macroses WHERE char_obj_id NOT IN (SELECT obj_Id FROM characters); DELETE FROM character_hennas WHERE char_obj_id NOT IN (SELECT obj_Id FROM characters); DELETE FROM character_friends WHERE char_id NOT IN (SELECT obj_Id FROM characters); DELETE FROM character_subclasses WHERE char_obj_id NOT IN (SELECT obj_Id FROM characters); DELETE FROM couples WHERE player1Id NOT IN (SELECT obj_Id FROM characters); DELETE FROM couples WHERE player2Id NOT IN (SELECT obj_Id FROM characters); DELETE FROM pets where item_obj_id not in (SELECT object_id FROM items); DELETE FROM seven_signs WHERE char_obj_id NOT IN (SELECT obj_Id FROM characters); DELETE FROM forums WHERE forum_owner_id <> '0' AND forum_owner_id NOT IN (SELECT clan_id FROM clan_data); Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
AlexMan 27 Опубликовано 22 июля, 2012 не пойму как он будет пахать когда в первую очередь удаляет Чаров, а потом уже их скилы и тд хотя условия идет такое SELECT obj_Id FROM characters Эт как бы удалили чаров и берем данные чаров неоткуда уже Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
•°•°•PsycHoO•°•°• 1583 Опубликовано 22 июля, 2012 ап Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты