i have table A with 2 columns was filled: Date, product. and column count still empty
my expectation, if same product have in same date then count 1.
i want the flag in count as sequence.
i got stuck, thanks before
CodePudding user response:
You may use DENSE_RANK()
here:
SELECT date, product, DENSE_RANK() OVER (ORDER BY date, product) count
FROM yourTable
ORDER BY date, product;