'partition by customer for distinct items

enter image description here

select customer_id, row_number()over(partition by customer id order by date) as rn from table

enter image description here

How to get same rn when Item Id is the same?

Below did not work: #1 select customer_id, row_number()over(partition by customer id, Item Id order by date) as rn from table



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source