Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::General Support

Support::General Support Post all topics here having to do with errors while trying to connect to an EQEMu server but not about the setup/running of the Server itself.

Reply
 
Thread Tools Display Modes
  #1  
Old 08-27-2019, 12:11 PM
jaspen
Hill Giant
 
Join Date: Apr 2016
Posts: 107
Default Help with code to remove a list of loot drops.

I am looking for a way to remove a large list of items from the lootdrop tables so each time I update the database, I can run this script/command. An example is, currently, non-visible defiant gear was left in the loot drops (ie. Combatant's and Adept's), while visible gear was removed and added to global loot (ie. Crude Defiant, Simple Defiant, etc.). I want to finish removing those and will add those manually to global as well.

I read around the forums, and found a way to search for a word or phrase, it would list all matching items in Heidi and in turn, I would have to manually select and delete all offending items. If possible, I would like it to automatically delete all from a list I create.

Is there a reasonable way of doing this?
Reply With Quote
  #2  
Old 08-27-2019, 01:48 PM
chrsschb's Avatar
chrsschb
Dragon
 
Join Date: Nov 2008
Location: GA
Posts: 904
Default

Code:
DELETE FROM lootdrop_entries
WHERE item_id in (itemid1, itemid2, itemid3, ...);
I believe that will do it. Just add to the list as you get more items.
__________________
Clumsy's World: Resurgence [2019-Present]
Clumsy's World 2.0 [2014-2016]
Clumsy's World [2006-2012]
Reply With Quote
  #3  
Old 08-27-2019, 01:59 PM
jaspen
Hill Giant
 
Join Date: Apr 2016
Posts: 107
Default

Thanks, I wasn't expecting so simple. Had I wrote it I would have used =. Is there an easy explanation for why you use in for this situation? Still learning...
Reply With Quote
  #4  
Old 08-27-2019, 02:22 PM
jaspen
Hill Giant
 
Join Date: Apr 2016
Posts: 107
Default

The in refers to the stuff in the ( )... For some reason I was expecting a deeper meaning but it was simply straightforward.
Reply With Quote
  #5  
Old 08-27-2019, 07:44 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

You can even put another query inside the where clause parentheses

Just make sure the query returns a list of single field results.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #6  
Old 08-28-2019, 10:41 AM
jaspen
Hill Giant
 
Join Date: Apr 2016
Posts: 107
Default

Quote:
Originally Posted by Uleat View Post
You can even put another query inside the where clause parentheses

Just make sure the query returns a list of single field results.
Could you give a simple example?
Reply With Quote
  #7  
Old 08-28-2019, 05:46 PM
Uleat's Avatar
Uleat
Developer
 
Join Date: Apr 2012
Location: North Carolina
Posts: 2,815
Default

Code:
DELETE FROM `lootdrop_entries`
WHERE `item_id` IN (
  SELECT `id` FROM `items` WHERE `Name` LIKE 'Ornate Defiant%' 
);
With something like that, you can tailor the inner query to your desires before you ever run the outer one.
__________________
Uleat of Bertoxxulous

Compilin' Dirty
Reply With Quote
  #8  
Old 08-29-2019, 08:17 AM
Turmoiltoad
Forum Guide
 
Join Date: Apr 2013
Posts: 27
Default

Also, if it's something you think you might want to undo someday...make use of "disabled_chance" field instead of deleting them all:

Code:
UPDATE lootdrop_entries
SET disabled_chance = chance, chance = 0
WHERE item_id (...follow Uleat's example)
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:23 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3