Teensy modification
The problem was that MySQL is using that primary key as the replace logic marker... without that it's doing an insert with an primary keys, so it's giving it zero for the ID -- over and over and over again. So, all your records were going in, as ID 0, each rewriting the previous one (kinda cruel).
Here is the fix, and it's simple.
Add the ID to the REPLACE clause and the SELECT clause-- as :
REPLACE INTO
`spells_new`(
`id`,
`player_1`,
`teleport_zone`,
`you_cast`,
`other_casts`,
...
SELECT
`spells_old`.`id`,
`spells_old`.`player_1`,
`spells_old`.`teleport_zone`,
`spells_old`.`you_cast`,
`spells_old`.`other_casts`,
...
FROM
`spells_old`,
`spells_new`
WHERE
`spells_old`.`name` = `spells_new`.`name` AND
`spells_old`.`classes2` <= 60;
but DO NOT add the ID column as a criterion to the WHERE clause at the bottom. You could add it, but it's not needed.
|