Re: Pragmatically changing a "Record Number"
| From: | Jason Pruim | Date: | Wed, 29 Aug 2007 19:09:10 +0000 |
| Subject: | Re: Pragmatically changing a "Record Number" | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-261493@lists.php.net to get a copy of this message | ||
On Aug 29, 2007, at 2:27 PM, Jim Lucas wrote:
Jason Pruim wrote:No, I am aware that it doesn't reuse the auto increment numbers.Are you thinking mysql reuses auto-increment number? If so, your mistaken.3. Ask yourself, "Is it important to keep the auto-increment field contiguous?"The main reason for changing it is I do currently have an option to sort by record number, although, if I add a Record number in php, but still have it sort based off of the record number stored in the database, it would still sort right, but also look right...
MySQL will not reuse an auto-increment unique value. say you have an empty table with an auto-increment column. You add 5 row your next id to be used is 6. if you delete id # 2 and 3 the next id to be used will still be 6 not 2And what I'm looking for is away to take rows 4 and 5 and move them to rows 2 and 3 so the next record inserted would be row 4 :)
it does not go back and fill in the holes/gaps --Jim Lucas "Some men are born to greatness, some achieve greatness,-- Jason Pruim Raoset Inc. Technology Manager MQC Specialist 3251 132nd ave Holland, MI, 49424 www.raoset.com japruim@raoset.comand some have greatness thrust upon them."Twelfth Night, Act II, Scene Vby William Shakespeare