Reputation: 36050
How could I do the opposite of:
In other words select all the people whose last name is NOT Hansen or Pettersen.
Upvotes: 10
Views: 20374
Reputation: 2398
SELECT * FROM Persons WHERE LastName NOT IN ('Hansen','Pettersen')
Upvotes: 5
Reputation: 93715
Negate your condition with NOT.
select * from persons
where NOT (LastName IN ('Hansen','Pettersen'));
Upvotes: 2
Reputation: 175866
You can negate the IN
with NOT
:
SELECT * FROM Persons
WHERE LastName NOT IN ('hansen', 'Pettersen')
Upvotes: 4
Reputation: 52675
WHERE lastname NOT IN ('Hansen', 'Pettersen')
see the section "The IN and NOT IN operators" in SQL As Understood By SQLite
Upvotes: 23