Always use the simple case
WHERE a=10 or b=10 or c=10
WHERE a=10 and b=10 and c=10
and it looks like you want to say
WHERE (a=10 or b=10) and c=5
or maybe
WHERE a=10 or (b=10 and c=5)
The general rule is you have to compare each operand in the where clause and
operators are left to right so if you want to change the order of the
oerators, you have to use parens.
>From: "Jake C" <jakeone@b...>
>Reply-To: "sql language" <sql_language@p...>
>To: "sql language" <sql_language@p...>
>Subject: [sql_language] multiple where clauses
>Date: Tue, 13 Feb 2001 15:40:12
>
>Can someone tell me the correct syntax for the following WHERE clauses.
>I've been experimenting but can't be sure I'm getting it right.
>
>1. I want to say: "SELECT... WHERE a OR b OR c = 10"
>I'm using: "SELECT... WHERE a,b,c = 10"
>
>2. I want to say: "SELECT... WHERE a AND b AND c = 10"
>I'm using: "SELECT... WHERE a and b and c = 10"
>
>3. I want to say: "SELECT... WHERE a OR b = 10 AND c = 5"
>I'm using "SELECT... WHERE a,b = 10 AND c = 5"
>
>What is the general rule for constructing WHERE clauses with AND/OR?
>
>Many thanks on any help you can give.
>