That said, I have a feeling your duplicates can be fixed by adding the requirement that c.cid < c2.cid
Not sure a window function would help in this particular situation, but they are there to help in more mundane examples.
That said, I have a feeling your duplicates can be fixed by adding the requirement that c.cid < c2.cid
Not sure a window function would help in this particular situation, but they are there to help in more mundane examples.