I'm trying to ignore duplicates between two providers in my tables while using join.
I'm using this query for now:
SELECT *
FROM A AS a1, A AS a2
WHERE a1.provider <> a2.provider AND a1.etype = a2.etype
Unfortunately, that query gives me duplicates (two rows of the same providers, in opposite sides).
I'm trying to ignore rows that appear twice in the opposite sides, for example:
etype provider etype provider
hello aaa hello bbb
hello bbb hello aaa
This dbfiddle illustrates the desired output as well.
INNER JOIN .. ON .. AND ..would have more clear sense thanLEFT JOIN– Kondybas Oct 31 '18 at 16:48INNER JOIN .. ON .. AND ..is equivalent to my first query withUSINGbut not with the 2nd query withLEFT JOIN. – Erwin Brandstetter Oct 31 '18 at 16:59