View Single Post
  #3  
Old 03-26-2018, 01:38 PM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

PURPOSE: Export a a list of items made by tradeskills into a CSV file for later use.
NOTE: no (idea what i was typing here...)

Code:
SELECT                             -- SELECT indicates these are the fields we want
  tre.item_id AS item_id,          -- item_id from tre table
  tr.name AS item_name             -- item_name from tr table
INTO OUTFILE                       -- indicates we are saving results to file
  "F:/ts_yields.csv"               -- full file path
FIELDS TERMINATED BY               -- field are separated by ...
  ','                              -- a comma, since this is a CSV
OPTIONALLY ENCLOSED BY             -- fields with whitespace enclosed in ...
 '"'                               -- double quotes
LINES TERMINATED BY                -- rows end in ... 
  '\n'                             -- a newline
FROM                               -- FROM lists tables to look for fields in
  tradeskill_recipe AS tr,         -- tr is now shorthand for tradeskill_recipe
  tradeskill_recipe_entries AS tre -- tre is now shorthand for tradeskill_recipe_entries
WHERE                              -- WHERE is how we filter results
  tre.recipe_id = tr.id AND        -- match recipe_id in tre and tr
  tre.componentcount < 1 AND       -- tre item is not a component
  tre.iscontainer < 1 AND          -- tre item is not a container
  tre.item_id > 0                  -- make sure the item number is valid
GROUP BY                           -- GROUP BY is used here to weed out duplicates
  tre.item_id                      --  (result set is 15008 rows with, 30248 without)
ORDER BY
  tre.item_id, tr.name;
Code:
1057,"Mystic Cloak"
1080,"Mithril Studded Skullcap"
1081,"Mithril Studded Mask"
1082,"Mithril Studded Gorget"
1083,"Mithril Studded Tunic"
1084,"Mithril Studded Shoulderpads"
1085,"Mithril Studded Cloak"
1086,"Mithril Studded Belt"
1087,"Mithril Studded Sleeves"
1088,"Mithril Studded Wristbands"
1089,"Mithril Studded Gloves"
1090,"Mithril Studded Leggings"
1091,"Mithril Studded Boots"
1095,"Case Of Tunarean Crests"
<SNIP!>
124684,"Warlord's Bane XVII"
124685,"Messenger's Bane XVII"
124686,"Quellious' Trauma XVII"
124687,"Solusek's Burn XVII"
__________________
I muck about @ The Forge.
say(rand 99>49?'try '.('0x'.join '',map{unpack 'H*',chr rand 256}1..2):'incoherent nonsense')while our $Noport=1;

Last edited by c0ncrete; 03-26-2018 at 01:47 PM.. Reason: typo
Reply With Quote