Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Database/World Building

Development::Database/World Building World Building forum, dedicated to the EQEmu MySQL Database. Post partial/complete databases for spawns, items, etc.

Reply
 
Thread Tools Display Modes
  #1  
Old 01-13-2015, 04:24 PM
pythag
Sarnak
 
Join Date: Jan 2012
Posts: 56
Default SQL code help

Hi
I am playing around with a solo server for now, and wish to attemp a global DB change (to see if I can).
I want to update an entry in table1 based on an entry in table2

Code:
UPDATE lootdrop_entries SET chance = 50 IF items COLUMN name = *defiant*;
- I know its very wrong

ie if in the items table column name it says defiant then change the lootdrop_entries table column chance to be 50%

I know the tables are linked by item_id so they should connect

Also would this back up a single table prior to me messing with it?
Code:
SELECT * INTO backuplootdrop_entries FROM lootdrop_entries;
Again any help gratefully received
Reply With Quote
  #2  
Old 01-14-2015, 11:56 AM
werebat's Avatar
werebat
Hill Giant
 
Join Date: Oct 2010
Posts: 143
Default

For backup you could say:
create table backuplootdrop_entries as select * from lootdrop_entries;

This will make a copy of the lootdrop_entries table.
Reply With Quote
  #3  
Old 01-14-2015, 12:02 PM
werebat's Avatar
werebat
Hill Giant
 
Join Date: Oct 2010
Posts: 143
Default

I am not in front of my eqemu computer but i beleive this will work for your chance adjustment

Code:
update lootdrop_entries set chance = 50 where item_id in (select id from items where name regexp '(Crude|Simple|Rough|Ornate|Flawed|Intricate|Elaborate|Elegant)( Defiant)');
Reply With Quote
  #4  
Old 01-14-2015, 08:28 PM
pythag
Sarnak
 
Join Date: Jan 2012
Posts: 56
Default

Superb - thank you makes sense when I read it but never would have got it, and so over to the dark side of sql
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 03:32 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