5
From what I understand you would like to have a sequence of 1 a n
no matter the value of the field id
.
I think it would be something like this:
SELECT
row_number() OVER (ORDER BY id_grupo) AS ROWNUM,
nome
FROM
grupos;
I created a fiddle for tests:
use windows. example select id_group,id_user, name, rank() over (order by id) from <table>
– carlos
How much a column has the attribute
AUTO INCREMENT
you don’t have to worry about it, since the value will be automatically placed for you when entering, and it will also always be sequential even if you delete a record.– hugofsousa