Skip to content
Advertisement

Rank Values by Partition in SQL

I am trying to create a new column that counts unique partitions of another column.

I have tried using

but each partition’s count stays the same at 1.

How would I go about getting results for *NewCol?

Advertisement

Answer

You are looking for just the order by

The partition by causes the value to be 1 for all cola, because only one value is considered in each partition.

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement