Skip to content
Advertisement

Selecting single row if it matches another

I have a scenario of this type:

enter image description here

I want to select only one row in such a scenario. How can I achieve this?

Advertisement

Answer

You could use distinct on with least() and greatest():

An alternative is not exists:

Finally: if all of the rows are duplicated, then a simple where condition is sufficient:

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