it's because of the way you've structured the query.

SQL is reading it like this:

WHERE

hidden = 1 AND DIM <= 200 AND COLOR1 = 'gold'

OR

COLOR2 = 'gold' AND WKSTN >= 2

so your output of COLOR2=gold and WKSTN=4 is right in line with the 2nd half
of the OR query.

you should have:

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

i think that should do it.

-----Original Message-----
From: Chad Gray [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 21, 2001 10:33 AM
To: CF-Talk
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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to