Thread: SQL Query help
View Single Post
  #2  
Old 03-08-2012, 08:10 PM
ProSkeptic
Fire Beetle
 
Join Date: Feb 2012
Location: New York and Charlotte
Posts: 17
Default My suggestion...

Temp tables.

First, backup the original table (just in case) as :

CREATE IF NOT EXISTS bkp_table LIKE original_table;
INSERT INTO bkp_table select * FROM original_table;


Verify the counts, to be sure everything made it with this statement :
SELECT "original_count", count(*) FROM original_table UNION
SELECT "backup_count", count(*) FROM bkp_table;


Then try importing the data to a new table. We backed up the data JUST in case the import clobbers the old table.

Now, here's the secret...

Insert into a new 'scratch' table as :

INSERT INTO new_spell_table ( id, name, classes2 )
SELECT B.id, N.name, N.classes2
FROM first_spells_table A, imported_table B
WHERE A.classes2 < 61 AND A.id = B.id


Then check the new-spell table to see if it's got all you need.

If it's not good, tweak that query some

If it IS good then just move that new_spell_table into the real spell table.

Sounds like a lot of work, but I'm not entirely sure of which tables you need to use.
Reply With Quote