Reputation: 7610
I was trying to execute a query which gets me all the info from Merchant table where PackageID is not equal to 21 or 22 or 23..
Select * from Merchant where PackageID NOT '22' Union Select * from Merchant where PackageID Not '21'
Thanks!!
Upvotes: 4
Views: 7572
Reputation: 171559
You can use the NOT IN
clause for this:
select *
from Merchant
where PackageID not in ('21','22')
Upvotes: 0
Reputation: 25390
use PackageID NOT IN (21, 22, 23..)
Select * from Merchant
where PackageID NOT IN (21, 22, 23)
Upvotes: 8