Reputation: 1
Consider this table:
name mark1 mark2 mark3
x 1 2 2
y 2 2 2
z 1 2 3
Here, I need to select the non distinct for example consider row three, where it contains only one "2" in column2. For this how to write a SQL code? I have made it of using the count and distinct commands but not able to get it.
Upvotes: 0
Views: 140
Reputation: 7189
in case you need to select all columns contain values that are unequal
like in this case row3
SELECT *
FROM table a
WHERE a.m1<>a.m2
AND a.m2<>a.m3
AND a.m1<>a.m3
Upvotes: 0
Reputation: 941
If I understand your question enough, it would be like this:
select * from mark where (mark1<>mark2 and mark1<>mark3 and mark2<>mark3);
Upvotes: 0