Skip to content
Advertisement

Just get one data if duplicate (not DISTINCT)

I have the following result from a query in mysql (headers: depicao, arricao):

EDDH, EDDK
EDFH, EDDL
EDDS, EDDH
EDDK, EDDH

My problem is now, that I just want one of the rows, IF the data exist in the correlation “EDDH – EDDK” AND “EDDK – EDDH”.

The query for this result is something like this:

Thanks for your help!

Advertisement

Answer

Order the columns in a consistent way with GREATEST and LEAST, then use SELECT DISTINCT to remove duplicates.

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