Re: Update table to get consecutive Primary keys

From: Date: Fri, 09 Jun 2006 05:14:29 +0000
Subject: Re: Update table to get consecutive Primary keys
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-237661@lists.php.net to get a copy of this message
Antonio Bassinger wrote:
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?
Read this thread: http://marc.theaimsgroup.com/?l=php-general&m=114656385709968&w=2 It will tell you this is a really bad idea. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#237661) next »