SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 condition in where
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

inbs
Aged Yak Warrior

836 Posts

Posted - 03/11/2013 :  16:11:06  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
6062 Posts

Posted - 03/11/2013 :  16:41:23  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000