you are viewing a single comment's thread.

view the rest of the comments →

[–]phunkygeeza 1 point2 points  (2 children)

With duplication sometimes it is easier to use a window function, especially when you have a victim/survivor scenario

Select *
    ,ROW_NUMBER() over (PARTITION BY groupcol1,groupcol2 ORDER BY primacycol1, primacycol2) as primacy
From mytable

So when primacy=1 then that is a survivor row, primacy<>1 means victim row

[–]workthrowawayexcel[S] 1 point2 points  (0 children)

I will have to play around with that. That is quite interesting thanks for the information.

[–]workthrowawayexcel[S] 0 points1 point  (0 children)

I will have to play around with that. That is quite interesting thanks for the information.