Reputation: 353
I am trying to write SQL query to get records that have different values between the customer
and the external
columns.
login customer external
-------- ---------- --------
william will200 will201
haymen hay100 hay100
norman nor345 nor346
bernie ber23 ber23
william1 will100 will101
max max65 max65
norman1 nor789 nor790
Output should be
login customer external
-------- -------- --------
william will200 will201
william1 will100 will101
norman nor345 nor346
norman1 nor789 nor790
I tried different queries but couldn't retrieve the desired output.
Any suggestions?
Thanks
Upvotes: 1
Views: 979
Reputation: 1269443
I think your question is: "get records that DO NOT have duplicate values on 2 columns". This is based on your result set and sample data.
If so:
select t.*
from t
where login <> customer and customer <> external and login <> external;
At the very least, this returns the rows for your desired results.
Upvotes: 1