Loading...   

  • Created By Uleat On: 04:09 PM August 01, 2016
  • Link

-- Tradeskill Recipe Entry Container Insert Query
-- ----------------------------------------------
--
-- This will add containers to recipe entries whose recipe
-- tradeskills are in the set {60, 61, 63, 64, 65, 75} and do
-- not have a container listed.
--
-- The selection criteria keep the query duplication safe and
-- additional tradeskill criteria may be added to both the
-- number set and the CASE critiera.
--
-- To add a case operator, use the following format:
-- WHEN tr.`tradeskill` = '<EQEmu::skills::<skill>>'
--     THEN '<EQEmu::item::<bagtype>>'
--
-- Using HeidiSQL and a filter on the `tradeskill_recipe` table
-- will show entries for tradeskills not in the number set:
-- [filter] `tradeskill` NOT IN (60, 61, 63, 64, 65, 75)
--
-- All number set criteria must have a case operator or
-- undefined behavior will occur.

INSERT INTO `tradeskill_recipe_entries` (`recipe_id`, `item_id`, `successcount`, `failcount`, `componentcount`, `salvagecount`, `iscontainer`)
SELECT
	tr.`id` recipe_id,
	CASE
		WHEN tr.`tradeskill` = 60 THEN 15
		WHEN tr.`tradeskill` = 61 THEN 16
		WHEN tr.`tradeskill` = 63 THEN 17
		WHEN tr.`tradeskill` = 64 THEN 18
		WHEN tr.`tradeskill` = 65 THEN 19
		WHEN tr.`tradeskill` = 75 THEN 30
	END item_id,
	0 successcount,
	0 failcount,
	0 componentcount,
	0 salvagecount,
	1 iscontainer
FROM `tradeskill_recipe` tr
WHERE tr.`id` NOT IN (SELECT tre.`recipe_id` FROM `tradeskill_recipe_entries` tre WHERE `iscontainer` = 1)
AND tr.`tradeskill` IN (60, 61, 63, 64, 65, 75) -- tradeskill number set

Raw Paste Data