Hi,
I have a question regarding Over(Partition by
This is a short description of my data.
Customer Id Product Id CreateDate
10 A 2020-01-01
10 A 2020-01-01
10 A 2020-01-01
10 B 2019-11-01
10 B 2019-11-01
20 A 2020-03-01
I need a query that shows the information as below;
Customer Id Product Id CreateDate SequenceNo
10 A 2020-01-01 1
10 A 2020-01-01 1
10 A 2020-01-01 1
10 B 2019-11-01 2
10 B 2019-11-01 2
20 A 2020-03-01 1
How can I write a query in SQL that shows the information above?

Sachin SinghRank #66 · 26.2K reputationPosted Nov 4, 2020, 2:32 AM EST
The DENSE_RANK function does not skip any ranks if there is a tie between the ranks of the preceding records, the rank is decided by the order by parameter passed inside Over , so you are trying to get same rank based on Created Date Column so you should use
Junaid MuslaRank #8,429 · 222 reputationPosted Nov 4, 2020, 1:56 AM EST
Nisha RegilRank #1,956 · 748 reputationPosted Nov 4, 2020, 1:19 AM EST