How do I do a "AND & OR" SQL QUERY AT THE SAME TIME?

greenspun.com : LUSENET : SQL Server Database Administration : One Thread

SELECT * FROM CAD WHERE "Project Number" = '::Project::' AND "Drawing Number" = '::Drawing::' OR "Project Number" = '::Project::' OR "Drawing Number" = '::Drawing::'

I TRIED THAT WAY AND THE ALSO THE FOLLOWINGSELECT * FROM CAD WHERE "Project Number" = '::Project::' AND OR "Drawing Number" = '::Drawing::'

-- Anonymous, May 29, 2000

Answers

Dac,

The 'AND' operator has higher precedence than the 'OR' operator. That is, if there are no parentheses, the 'AND' is evaluated first.

You will certainly be able to create the select statement you need if you add enough parentheses.

Good Luck,

Eric

-- Anonymous, May 30, 2000


Moderation questions? read the FAQ