A support question: Somebody had a WordPress installation, in
which a table had entries with an id
column that
contained multiple entries with 0
. The table was
supposed to undergo a schema change where id
becomes
an actual primary key, and auto_increment
. They
needed to find all rows WHERE id=0
and assign them
unique id
values.
Here is a test table:
mysql> create table b ( id integer not null, d varchar(255));
Query OK, 0 rows affected (0.25 sec)
kris> insert into b values (0, "1"), (0, "2"), (3, "3");
Query OK, 3 rows affected (0.06 sec)
Records: 3 Duplicates: 0 Warnings: 0
kris> select * from b;
+----+------+
| id | d |
+----+------+
| 0 | 1 |
| 0 | 2 |
| 3 | 3 |
+----+------+
3 rows in set (0.00 sec)
[Read more]