How to create a sql mysql query in order to number the records in the table in a prepared column ?
Desirable 1 request if it is real.
How to create a sql mysql query in order to number the records in the table in a prepared column ?
Desirable 1 request if it is real.
update table set field=@num:=@num+1 where 0 in(select @num:=0) The numbering will go from 1. If you wish, you can correct the starting value and the method of calculating the following
It will be enough to put in advance the prepared auto_increment column when creating it and fill it with numbers in order:
ALTER TABLE таблица ADD COLUMN ( `заранее подготовленная колонка` int key auto_increment ); or
ALTER TABLE таблица CHANGE COLUMN `заранее подготовленная колонка` `заранее подготовленная колонка` int key auto_increment; Source: https://ru.stackoverflow.com/questions/523166/
All Articles