Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
anishap
Yak Posting Veteran
61 Posts |
Posted - 2010-09-17 : 15:54:23
|
I have a table with column TYPE1, TYPE2, TYPE3, TYPE4. I want to select rows that doesn't have 'METALS' in any of these 4 columns. I tried to query using 'OR' OPERATOR but it won't work.Can any one help me with this?Thanks |
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2010-09-17 : 15:59:41
|
you want a AND operator not ORSlect * from mytable where not type1 = 'METALS'andnot type2 = 'METALS'andnot type3 = 'METALS'andnot type4 = 'METALS' Success is 10% Intelligence, 70% Determination, and 22% Stupidity.\_/ _/ _/\_/ _/\_/ _/ _/- 881 |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-09-18 : 09:14:22
|
i prefer using column <> rather than not column =------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
rohitvishwakarma
Posting Yak Master
232 Posts |
Posted - 2010-09-20 : 05:39:31
|
SELECT * FROM mytable WHERE type1 <> 'METALS' ANDtype2 <> 'METALS' ANDtype3 <> 'METALS' ANDtype4 <> 'METALS' |
 |
|
|
|
|