SQL WHERE Query Help

Associate
Joined
18 May 2009
Posts
125
Location
Glasgow, UK
Hey guys, I'm trying to run a fairly large where clause as part of a query in SQL Server 2005 Enterprise and finding some problems.

Here is an example of the kind of selection I am after:

Assume each instance of var is a column name and x is a valud

WHERE ((var=x or var=x) and var=x and var=x) or (var=x and var=x)

However SQL reformats this to the following:

WHERE (var=x or var=x) and var=x and var=x or var=x and var=x
 
Back
Top Bottom