Home > Mobile >  how to add flag sequence number in unique and duplicate value using sql
how to add flag sequence number in unique and duplicate value using sql

Time:12-06

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. enter image description here

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;
  • Related