I have a table in a MySQL database. I want to display the item number (not the primary key) and then a row number.
item_num, row_number
1, 1
12, 2
1234, 3
15, 4
29, 5
Here is my query:
select item_num, row_number() over(partition by item_num) from items;
My output is this:
item_num, row_number
1, 1
12, 1
1234, 1
15, 1
29, 1
How can I fix this issue and show the correct row number for each item?
ida string or integer? Remove the partition and add an order by