How to update Auto increment value in single column field using a single query

Go to your database ->SQL

and add the following query like your table field

SET @ordering = 0;

UPDATE

table SET increment = (@ordering := @ordering + 1)

WHERE

field = ‘value’

ORDER BY

order_field;

Leave a Reply