Quote:
if someone know how to clean up pet_data this will be nice.
comments/suggestions are welcome.
|
haven't tested, but maybe so:
1) before item deletion
Code:
delete from pet_data where pet_id in (select ui.item_id from user_item as ui left join user_data as ud on (ui.char_id=ud.char_id) where ud.account_id = - 1);
--or--
2) after item deletion
Code:
delete from pet_data where pet_id not in (select item_id from user_item);
ps: btw your item deletion is wrong. it may delete some pledges' items. this one more correct:
Code:
delete from user_item where item_id in (select ui.item_id from user_item as ui left join user_data as ud on (ui.char_id=ud.char_id) where ud.account_id = - 1 and ui.warehouse<>2);
pps: better use user_deleted table to get info about deleted chars