Skip to content Skip to sidebar Skip to footer

How To Reorder Column Values In A Table?

When I delete some rows from a table it looks like the following table after removing: +-----+--------+----------+ | ID | Name | Address | +-----+--------+----------+ | 1 | n

Solution 1:

I think this type of query should do that:

UPDATE yourTable
SET ID = (SELECT COUNT(*) FROM yourTable ti WHERE ti.ID <= yourTable.ID)

Post a Comment for "How To Reorder Column Values In A Table?"