How can I auto increment id
column based on the 0 to max (int) value on the price
column.
Lets assume that price is ASC
, I want the id = 1
increment to start at the $0 mark. What would I have to edit for this code ALTER TABLE table AUTO_INCREMENT = 1
?
id | price | other columns
1 | 9
2 | 1
3 | 2
4 | 5
into
id | price | other columns
1 | 1
2 | 2
3 | 5
4 | 9