I have a table with 2 columns, one has a gid (serial) with intended duplicate values, I need them like that, and another column with a number, I need a 3rd column ("serial" in blue in the image) that looks like that. A serial number for each different "gid" but with the series from the "count" column
I tried row_number () over (partition by count order by gid) but I dont' get the correct results
EDIT: As Gordon Linoff says, I tried that and i get this results, not working as expected...

EDIT2: It works, I just needed to order the row_number, but this alters the rest columns of my table, would be any way to make row_number work in order since beggining wthout needing to order later?
EDIT3: Actually, it works perfectly, the display was wrong
