PDA

View Full Version : Mysql Query Help, Spell Merging.


Figback65
10-18-2014, 02:52 PM
Hello all,

I dont know if you guys offer any help on sql queries but If so, I could use some! I have tried and tried but cannot figure it out.

What I am trying to accomplish is copying info from my old spell_new to the new spell_new from the latest peqbeta.sql

I have renamed my spell table to spell_old and the new is obviously spell_new.
I am doing this because I have changed values like spell levels and am wanting to start with a new table with fresh changed. So the query I am looking for is match this column of tableA with tableB and if match, merge info, If it doesnt match then do nothing. I got it to sorda work once and anything that matched merged fine but anything that didnt match got turned to 0 value.

This is the one that worked but changed unmatching to 0, which i need to fix.
UPDATE spells_new
SET spells_new.classes14 = (
SELECT spells_old.classes14
FROM spells_old
WHERE spells_old.name = spells_new.name LIMIT 1
);


This is 1 i am playing around, dont know exactly if INNER JOIN is what i need but still trying.
SELECT name
FROM spells_old
INNER JOIN spells_old.classes1 ON spells_new.name = spells_old.name;

Thanks guys!

Fig

Kingly_Krab
10-18-2014, 03:06 PM
You don't have to do this. Just have an exported spell file from the old database, make a folder in your server folder called 'import' and run your import_client_files.exe. The change in column names is only for helping with understanding, the number of columns in the spells_us.txt is constant, meaning it can be imported or exported from any database and contain the same number of columns in the .txt file.

Figback65
10-18-2014, 03:25 PM
Hmm I am only tryen to update only certain columns though, not everything. I dont want my particles to change bc I had changed them b4.... Does that merge everything? From what you typed i think sounds like something different than I am neededing.

Kingly_Krab
10-18-2014, 03:28 PM
It puts in the entire spell file. So just export your old spell file from your old database, if you have one already you can just import the old spell file as is.

Figback65
10-18-2014, 03:34 PM
ya, thats not what i need. I know how to i/o spell files and such. I am tryen to take matching names(spellname) from table2 to table1 if they match then copy info over.

Figback65
10-18-2014, 08:03 PM
i got it figured out. Thanks tho

Figback65
10-24-2014, 10:31 PM
The fix. Forgot to post for people to use.


UPDATE spells_new
JOIN spells_old ON spells_new.name = spells_old.name
SET spells_new.mana = spells_old.mana