Update table to get consecutive Primary keys
| From: | Antonio Bassinger | Date: | Fri, 09 Jun 2006 04:58:57 +0000 |
| Subject: | Update table to get consecutive Primary keys | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-237660@lists.php.net to get a copy of this message | ||
Hi All!
I've a MySQL table:
table (id INT NOT NULL AUTO_INCREMENT,
flag TINYINT NOT NULL,
msgID VARCHAR(30) NOT NULL,
msgName VARCHAR(30),
size INT NOT NULL,
PRIMARY KEY(id));
If I delete a row, say 5th, the id entries are 1 2 3 4 6 7 ... 10.
I wish to keep entries consecutive, that is rearrange the table as 1 2 3 4 5
6 ... 9. How do I go about it?
Thanks & Regards,
Antonio