I have table_a with column product_id, store_id, x.
I want to
create table_b as
select store_id, product_id, sequence_number
from table_a
sequence_number is auto generated number that is supposed to look like this:
store_id | product_id | sequence_number
1 | 1 | 1
1 | 1 | 2
1 | 1 | 3
1 | 2 | 1
1 | 2 | 2
2 | 1 | 1
2 | 1 | 2
Is it possible to do this with sql query?
row_number(): postgresql.org/docs/current/static/tutorial-window.html