Log in

View Full Version : lootdrop mass update


Warking
02-06-2016, 03:46 PM
I would like to add lootdrop id 165862 to Every single loottable in the database.

I am having issues with the sql update for this as I would have to add rows for every loottableID in the loottable_entries table.

Uleat
02-06-2016, 07:43 PM
Try this:

INSERT INTO `loottable_entries` (`loottable_id`, `lootdrop_id`, `multiplier`, `droplimit`, `mindrop`, `probability`)
SELECT lt.c1, lt.c2, lt.c3, lt.c4, lt.c5, lt.c6
FROM (SELECT DISTINCT `loottable_id` c1, '165862' c2, '1' c3, '1' c4, '0' c5, '100' c6 FROM `loottable_entries`) lt


c1 = `loottable_id`
...
c6 = `probability`


You'll need to adjust the c3 through c6 values in the third line to whatever you want the 'default' to be.


EDIT: If you have already made any entries with that item id, the script will probably fail on duplicate key entry.

If that's the case, you can run:

DELETE FROM `loottable_entries` WHERE `lootdrop_id` = '165862'

to clear out any existing entries.

Warking
02-06-2016, 08:01 PM
Getting a response with

ERROR 1062 (23000) at line 1 in file: 'Z:\EQProject\A1 - MAss DB Update Strings\
new.sql': Duplicate entry '81-165862' for key 'PRIMARY'

Uleat
02-06-2016, 08:07 PM
I didn't get my edit in fast enough :P

Warking
02-06-2016, 09:48 PM
lol :) thanks. yep had to remove existing entries

Uleat
02-06-2016, 09:49 PM
Lol! Always 2 seconds too late!

Np :)