why this Query is not running

select col1,col2,col3,col4,col5 from TABLE

where col1 between 816 and 18644 and col2 between 0.19 and 8.02

and col3 between 'D' and 'Q'

and col4='FL' or col4='VVS1' or col4='VVS2' or col4='VS1' or col4='VS2' or col4='SI1' or col4='SI2' or col4='SI3' or col4='I1' or col4='I2' or col4='I3'

and col5='GIA' or col5='EGL' or col5='AGS' or col5='HOUSE'

* all value between ' ' is string variable name .

OR same more real example

select WEIGHT,COLOR,CLARITY,AGENCY,PRICE from TABLE

where PRICE between 816 and 18644 and WEIGHT between 0.19 and 8.02 and COLOR between 'D' and 'Q'

and CLARITY='FL' or CLARITY='VVS1' or CLARITY='VVS2' or CLARITY='VS1' or CLARITY='VS2' or CLARITY='SI1' or CLARITY='SI2' or CLARITY='SI3' or CLARITY='I1' or CLARITY='I2' or CLARITY='I3'

and AGENCY='GIA' or AGENCY='EGL' or AGENCY='AGS' or AGENCY='HOUSE'

[968 byte] By [smallkida] at [2007-11-27 11:24:59]
# 1

You're forgetten to nest the OR's.

BalusCa at 2007-7-29 16:01:45 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

Code here is rewritten to nest OR statements, and to make it easier to read:

select

col1,col2,col3,col4,col5

from

TABLE

where

(col1 between 816 and 18644) and

(col2 between 0.19 and 8.02)and

(col3 between 'D' and 'Q')and

(

col4='FL' or col4='VVS1' or col4='VVS2' or

col4='VS1' or col4='VS2' or col4='SI1'or

col4='SI2' or col4='SI3' or col4='I1' or

col4='I2' or col4='I3'

) and

(col5='GIA' or col5='EGL' or col5='AGS' or col5='HOUSE')

George123a at 2007-7-29 16:01:45 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...