All pastes #990543 Raw Edit

SQL Cleanup

public sql v1 · immutable
#990543 ·published 2008-04-20 05:52 UTC
rendered paste body
-- (07:47:11 AM) Xavier: -create temp creatures id list: CREATE TABLE `tempcreatures` (`entry`) SELECT DISTINCT `creature_loot_template`.`entry` FROM `creature_loot_template` INNER JOIN `cleanup` ON `creature_loot_template`.`item` = `cleanup`.`lootid` ORDER BY `creature_loot_template`.`entry`-- (07:47:16 AM) Xavier: -add creature 80001 with all items from teh cleanup table that actually exist: INSERT INTO `creature_loot_template` SELECT DISTINCT 80001 AS `entry`, `item`, .1 AS `ChanceOrQuestChance`,1 AS `group`,-80001 AS `mincountOrRef`, 1 AS `maxcount`, 0 AS `freeforall`,0 AS`lootcondition`,0 AS`condition_value1`,0 AS `condition_value2` FROM `creature_loot_template` INNER JOIN `cleanup` ON `creature_loot_template`.`item` = `cleanup`.`lootid` ORDER BY `creature_loot_template`.`entry`-- (07:47:21 AM) Xavier: -removes all creatures (including all item entries for these creatures) from the loot table where they have already been stored in tempcreatures: DELETE `creature_loot_template`.* FROM `creature_loot_template` INNER JOIN `cleanup` ON `creature_loot_template`.`item` = `tempcreatures`.`entry`-- (07:47:25 AM) Xavier: -inserts all creatures into the loot table where the creature is stored in the tempcreatures table and with a single item entry of 80001: INSERT INTO `creature_loot_template` SELECT `tempcreatures`.`entry`, 80001 As `item`, .1 AS `ChanceOrQuestChance`,1 AS `group`,-80001 AS `mincountOrRef`, 1 AS `maxcount`, 0 AS `freeforall`,0 AS`lootcondition`,0 AS`condition_value1`,0 AS `condition_value2` FROM `tempcreatures` ORDER BY `tempcreatures`.`entry`