i have following fields such as
Sno Location Owned Leased
1 chennai ltd gro
2 delhi Lcc nestle
3 coimbatore Lco musicword
4 Mumbai Aircell Vacant
in that i want the output Sno 3 and 4 datas only.
for that in sql through query how to use not in.
i remember we use not in query through sql how to do for my above question please send the query.
Rgds,
Narasiman P
Sqlserver
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Posted Jul 5, 2012, 12:15 AM EDT
select * from table1 where sno not in (1,2).
Kunal VaishyaRank #990 · 2K reputationPosted Jul 5, 2012, 12:16 AM EDT
tell us in details so we can help you
Satyapriya NayakRank #47 · 31.5K reputationPosted Jul 5, 2012, 12:31 AM EDT
You can do it in another way also
SELECT * FROM test WHERE (sno = 3) OR (sno = 4)
Thanks
Jignesh TrivediRank #16 · 50.3K reputationPosted Jul 5, 2012, 2:52 AM EDT
Agree with Muralidharan Dheenadhayalan for "not in" SQL server,
However "Not IN" Decrease Performance of Query
suggest to use "NOT EXISTS".
hope this will help.