SQL Parentheses and "AND" bug?

erobar at earthlink.net erobar at earthlink.net
Mon Jul 7 15:55:54 CDT 2003


(Note: forgive me if this is a duplicate; the first post didn't seem to go through)

Hey, all,

>From my understanding of SQL, the following statements should produce identical results:

select count(*) from table_A, table_B where
table_A.field_A >= 3 and table_A.field_A <= 5 and
table_B.field_B >= 3 and table_B.field_B <= 10

and

select count(*) from table_A, table_B where
table_A.field_A >= 3 and table_A.field_A <= 5 and
(table_B.field_B >= 3 and table_B.field_B <= 10)

[by the way: there is an object pointer from B to A which is in fine working condition, with no duplicates ]

Note: the ONLY difference is that I've added parentheses around the last 2 criteria, which produces the right results.  With the first SQL statement, it returns items where table_B.field_B is 1 through 5!  So, the third criterion seems to be obliterated somehow....

Anybody run into this at all?

thanks,
Liz




More information about the Valentina mailing list