I have a database table with more than one users and a column with auto increment ID.
The problem is when I create a new record where userId = 2, for example, it put the id of this row with the maximum id of the table.
So it's possible in query select * from items where userId = 2
return the lines numbered starting in 1 even if the first user record is 10 for example.
Example:
ID | ITEM | USERID
- 1 | Item 1 | 1
- 2 | Item 2 | 2
- 3 | Item 3 | 2
- 4 | Item 4 | 1
- 5 | Item 5 | 2
Select userid = 2 i want this:
ID | ITEM | USERID |COUNT
- 2 | Item 2 | 2 |1
- 3 | Item 3 | 2 |2
- 5 | Item 5 | 2 |3
Thank you