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.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 condition in where

Author  Topic 

inbs
Aged Yak Warrior

860 Posts

Posted - 2013-03-11 : 16:11:06
i have a lot of rows and i want to choose just where

A_TYPE<>'P' AND W_TYPE<>'F' OR A_TYPE<>'B'

#  A_TYPE   W_TYPE
1 P F
2 B F
3 P A
4 B K

i need to get just row 3,what is the condition i where clause?

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2013-03-11 : 16:41:23
When you combine ANDs and ORs you need to use parentheses in the appropriate spots.
perhaps this:
(A_TYPE<>'P' or W_TYPE<>'F') and A_TYPE<>'B'


Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -