I deleted the sales records from my sales table, and canceled sales, from my sales table. So the sales numbering got messy, like: it starts with 9, 10, 11, 14 .... How do I sort sales from # 1 and so on?
I deleted the sales records from my sales table, and canceled sales, from my sales table. So the sales numbering got messy, like: it starts with 9, 10, 11, 14 .... How do I sort sales from # 1 and so on?
Another solution to the scenario presented, ONLY if there are no relationships in this table:
SET @contador = 0;
UPDATE 'tabela_vendas' SET 'tabela_vendas'.'id' = @contador := @contador + 1;
Source: #
After this, run the command below, setting again the initial number of auto_imcrement
to 0:
ALTER TABLE tabela_vendas AUTO_INCREMENT = 0
I think you want to reshape AUTO_INCREMENT
. Try:
ALTER TABLE sua_tabela AUTO_INCREMENT = 0