Andre Yonadam
Andre Yonadam

Reputation: 1024

MySQL rearange auto increment after row is deleted

I was searching for a solution to my problem and didn't find one. Basically the user can add/delete information which will delete the row. The user can also arrange this information up/down which would also switch the primary keys (called placeholder). The problems are is that if the user deletes a row it won't move the placeholder int up one. I was wondering If there's any way to move the rows up and arrange them starting from 1.

Upvotes: 0

Views: 319

Answers (1)

null
null

Reputation: 3517

You shouldn't amend auto increment. It's part of the database design. You should use another column name as the identifier, ID perhaps?

Upvotes: 2

Related Questions