Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Avoiding parentheses
Message
From
22/09/2015 16:02:57
 
 
To
22/09/2015 13:41:11
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2012
Application:
Web
Miscellaneous
Thread ID:
01624934
Message ID:
01624941
Views:
51
>In this WHERE clause, I have parentheses:
>
>
>WHERE Client.NoProvince=@NoProvince AND
> NOT (Client.Status<@Status AND Client.NoStatus=@NoStatus) AND
> NOT (Client.Status<@Status2 AND Client.NoStatus=@NoStatus2) AND
> NOT (Client.Status<@Status3 AND Client.NoStatus=@NoStatus3) AND
> NOT (Client.Status<@Status4 AND Client.NoStatus=@NoStatus4) AND
> Client.NoCountry IN (1,2,3,4,5,6,7) AND
> Client.FirstName LIKE @LXList1Clm_No
>
>
>Would there be a way to avoid the parentheses? I see the execution is much smarter without those.

"not (A and B)" is the same as "(not A) or (not B)"

"not (A or B)" is the same as "(not A) and (not B)"

http://mathworld.wolfram.com/deMorgansLaws.html
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform