Skip to content
Advertisement

Assign Unique Group Id To Sets of Rows with Same Column Value Separated by Other value

I have some data that looks like this:

What I want is for each group which has the same radius value to have its own unique id, for example:

What I don’t want is the second group with radius 10 to have the same groupid as the first group (not 1).

I’m working on SQL Server but the solution should be the same across all databases.

(I’ve done this before, but for the life of me, I can’t remember how I did it.)

Advertisement

Answer

Try this:

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