How do I reset sequence numbers to become consecutive?
I've got a mysql table where each row has its own sequence number in a "sequence" column. However, when a row gets deleted, it leaves a gap. So... 1 2 3 4 ...becomes... 1 2 4 Is there a neat way to "reset" the sequencing, so it becomes consecutive again in one SQL query? Incidentally, I'm sure there is a technical term for this process. Anyone? UPDATED: The "sequence" column is not a primary key. It is only used for determining the order that records are displayed within the app. If the field is your primary key... ...then, as stated elsewhere on this question, you shouldn't be changing IDs.