Quantcast
Channel: How to remove reverse duplicates from a SQL query - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by wildplasser for How to remove reverse duplicates from a SQL query

SELECT *FROM link lWHERE NOT EXISTS ( SELECT * from link nx -- The condition below is true for both the twins WHERE nx.ip_src = l.ip_dst AND nx.ip_dst = l.ip_src -- this is true for only one of the...

View Article



Answer by Gordon Linoff for How to remove reverse duplicates from a SQL query

If you don't care about the ordering in the final result set, you can do:select distinct least(ip_src, ip_dst) as ip_src, greatest(ip_src, ip_dst) as ip_dstfrom link ;Note: this can result in pairs not...

View Article

How to remove reverse duplicates from a SQL query

Context:I have a select query where I have have link between devices. Some links have "reverse duplicates" that I would like to get rid of in the select query.I already searched for similar questions...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images