William Cozzolino
William Cozzolino

Reputation: 13

Cumulative count of repeated values, starting at 1

I have a list of individual ID keys that have duplicates. I'd like to deduplicate this by counting the instance of each repeated key. I can count the cumulative total, or count the number of repeated instances, but not count incrementally from 1 through x at the next first instance of the ID key.

Example, this is what I'd like to achieve enter image description here

Upvotes: 1

Views: 57

Answers (1)

mohan111
mohan111

Reputation: 8865

In SQL Query

Select IndividualKey,Row_number()OVER(PARTITION BY IndividualKey ORDER BY (SELECT NULL))ID From Table 

Upvotes: 2

Related Questions