I am trying to make a Postgres sequence that will reset once the id of the item it is linked to changes, e.g:
ID SEQUENCE_VALUE
1 1
2 1
1 2
1 3
2 2
3 1
I don't know PSQL or SQL in general very well and I can't find a similar question, any Help Is greatly appreciated!