View Single Post
Old 12-15-2007, 10:49 AM   #1 (permalink)
Capo64
Contributing Member
 
Join Date: 06-11-07
Posts: 164
iTrader: 0 / 0%
Latest Blog:
None

Capo64 is liked by somebodyCapo64 is liked by somebodyCapo64 is liked by somebody
MySQL Auto_increment

Is there a way to make auto_increment increment from the highest value in a column (not counting deleted entries)?

This is what happens now: I have a table with the ID column having auto_increment.

I create an entry. ID = 1.
I create another entry. ID = 2.
I delete entry 2.
I create another entry. ID = 3.
I end up with ID 1 and 3.

This is what I want to happen:

I create an entry. ID = 1.
I create another entry. ID = 2.
I delete entry 2.
I create another entry. ID = 2.
I end up with ID 1 and 2.

Is there something simple that will make this happen?
Capo64 is offline   Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links