Because you havent forced it to alter natural precedence

Try:

Select *
from products
where hidden = 1 AND
DIM <= 200 AND
( COLOR1 = 'gold' OR COLOR2 = 'gold' )
AND
WKSTN >= 2

(I have to ASSume that is what you want)

The rule I follow is: Parentheses are cheap. Use freely.



----- Original Message -----
From: "Chad Gray" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, June 21, 2001 11:33 AM
Subject: SQL question


> Im wondering why this SQL statement would bring up results where DIM is
> greater then 200?  I think it has something to do with the OR statement,
> but i dont know why.
>
> Select *
> from products
> where hidden = 1 AND
> DIM <= 200 AND
> COLOR1 = 'gold' OR
> COLOR2 = 'gold' AND
> WKSTN >= 2
>
>
>
> Here is my Output:
> ProductID : 3
> Dim : 600
> Color1 : blue
> Color2 : gold
> WKSTN : 4
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to