View Single Post
  #8  
Old 01-26-2004, 07:10 PM
Lurker_005
Demi-God
 
Join Date: Jan 2002
Location: Tourist town USA
Posts: 1,671
Default

Here, I just worked out the SQL to find NPC venders with empty item lists.
Code:
select id, name, merchant_id from npc_types left join merchantlist on merchant_id = merchantid where merchant_id <> 0 and merchantid is null;
and also to find items used on vendors but not in the DB
Code:
select npc_types.id, npc_types.name, merchant_id, merchantlist.slot, merchantlist.item from npc_types, merchantlist left join items on merchantlist.item = items.id where merchant_id <> 0 and merchant_id = merchantid and items.id is null;
and finally items used in loot but not in the DB
Code:
select npc_types.id, npc_types.name, npc_types.loottable_id, lootdrop_entries.item_id from npc_types, loottable_entries, lootdrop_entries left join items on lootdrop_entries.item_id = items.id where npc_types.loottable_id <> 0 and npc_types.loottable_id=loottable_entries.loottable_id and loottable_entries.lootdrop_id=lootdrop_entries.lootdrop_id and items.id is null;
Whew.
Hope that helps out. Note this will not find "broken" stuff if a a lootdrop or merchantlist entry

Oh one more for the tradeskill table items, sorry not sure of a way to make it all 1 query
Code:
select tradeskillrecipe.id, product from tradeskillrecipe left join items on product = items.id where product <> 0 and items.id is null;
select tradeskillrecipe.id, product2 from tradeskillrecipe left join items on product2 = items.id where product2 <> 0 and items.id is null;
select tradeskillrecipe.id, failproduct from tradeskillrecipe left join items on failproduct = items.id where failproduct <> 0 and items.id is null;
select tradeskillrecipe.id, i1  from tradeskillrecipe left join items on i1  = items.id where i1  <> 0 and items.id is null;
select tradeskillrecipe.id, i2  from tradeskillrecipe left join items on i2  = items.id where i2  <> 0 and items.id is null;
select tradeskillrecipe.id, i3  from tradeskillrecipe left join items on i3  = items.id where i3  <> 0 and items.id is null;
select tradeskillrecipe.id, i4  from tradeskillrecipe left join items on i4  = items.id where i4  <> 0 and items.id is null;
select tradeskillrecipe.id, i5  from tradeskillrecipe left join items on i5  = items.id where i5  <> 0 and items.id is null;
select tradeskillrecipe.id, i6  from tradeskillrecipe left join items on i6  = items.id where i6  <> 0 and items.id is null;
select tradeskillrecipe.id, i7  from tradeskillrecipe left join items on i7  = items.id where i7  <> 0 and items.id is null;
select tradeskillrecipe.id, i8  from tradeskillrecipe left join items on i8  = items.id where i8  <> 0 and items.id is null;
select tradeskillrecipe.id, i9  from tradeskillrecipe left join items on i9  = items.id where i9  <> 0 and items.id is null;
select tradeskillrecipe.id, i10 from tradeskillrecipe left join items on i10 = items.id where i10 <> 0 and items.id is null;
These could be modified to use unique to get just the items that are missing, but you should get the idea.
__________________
Please read the forum rules and look at reacent messages before posting.
Reply With Quote