
February 24th, 2013, 04:52 PM
|
|
Registered User
|
|
Join Date: Feb 2013
Posts: 2
Time spent in forums: 20 m 47 sec
Reputation Power: 0
|
|
|
"Never equal to" in SQL
Hello, SQL newbie question. If i have a table like this:
col1 col2
foo 1
foo 2
foo 3
bar 2
bar 3
How do a get all the distinct values in col1 for rows that are never equal to 1 in col2. In this case the query should return bar only because no row exists with bar and 1 together . if I filter on col2 <> 1 I get both foo and bar back. the pseudo code I need is
select distinct col1 where col2 is never equal to 1
thanks in advance
|