![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am probably missing something very obvious, but after looking and looking I just don't see it. |
|
I have the following query: SELECT DISTINCT A.AMT, A.CONTRACT FROM ATABLE A, BTABLE B, CTABLE C WHERE ( (B.X = '011170' AND B.Y = A.W) OR (C.M = A.Z AND C.N = A.T) ) AND A.FYEAR = '2008' AND A.FPRNO='3' This yields an empty set. However, if I remove the OR part and just have: SELECT DISTINCT A.AMT, A.CONTRACT FROM ATABLE A, BTABLE B WHERE ( (B.X = '011170' AND B.Y = A.W) ) AND A.FYEAR = '2008' AND A.FPRNO='3' Then it returns data. Since (B.X = '011170' AND B.Y = A.W) is true and (C.M = A.Z AND C.N = A.T) is false, shouldn't the compound statement in the parenthesis in the first one, separated by an OR, yields true, and so should yield data? It is acting as if (true or false) ===> false rather than true. |
#3
| |||
| |||
|
|
I am probably missing something very obvious, but after looking and looking I just don't see it. |
|
I have the following query: SELECT DISTINCT A.AMT, A.CONTRACT FROM ATABLE A, BTABLE B, CTABLE C WHERE ( (B.X = '011170' AND B.Y = A.W) OR (C.M = A.Z AND C.N = A.T) ) AND A.FYEAR = '2008' AND A.FPRNO='3' This yields an empty set. However, if I remove the OR part and just have: SELECT DISTINCT A.AMT, A.CONTRACT FROM ATABLE A, BTABLE B WHERE ( (B.X = '011170' AND B.Y = A.W) ) AND A.FYEAR = '2008' AND A.FPRNO='3' Then it returns data. Since (B.X = '011170' AND B.Y = A.W) is true and (C.M = A.Z AND C.N = A.T) is false, shouldn't the compound statement in the parenthesis in the first one, separated by an OR, yields true, and so should yield data? It is acting as if (true or false) ===> false rather than true. |
#4
| |||
| |||
|
|
I am probably missing something very obvious, but after looking and looking I just don't see it. |
|
I have the following query: SELECT DISTINCT A.AMT, A.CONTRACT FROM ATABLE A, BTABLE B, CTABLE C WHERE ( (B.X = '011170' AND B.Y = A.W) OR (C.M = A.Z AND C.N = A.T) ) AND A.FYEAR = '2008' AND A.FPRNO='3' This yields an empty set. However, if I remove the OR part and just have: SELECT DISTINCT A.AMT, A.CONTRACT FROM ATABLE A, BTABLE B WHERE ( (B.X = '011170' AND B.Y = A.W) ) AND A.FYEAR = '2008' AND A.FPRNO='3' Then it returns data. Since (B.X = '011170' AND B.Y = A.W) is true and (C.M = A.Z AND C.N = A.T) is false, shouldn't the compound statement in the parenthesis in the first one, separated by an OR, yields true, and so should yield data? It is acting as if (true or false) ===> false rather than true. |
#5
| |||
| |||
|
|
I am probably missing something very obvious, but after looking and looking I just don't see it. |
|
I have the following query: SELECT DISTINCT A.AMT, A.CONTRACT FROM ATABLE A, BTABLE B, CTABLE C WHERE ( (B.X = '011170' AND B.Y = A.W) OR (C.M = A.Z AND C.N = A.T) ) AND A.FYEAR = '2008' AND A.FPRNO='3' This yields an empty set. However, if I remove the OR part and just have: SELECT DISTINCT A.AMT, A.CONTRACT FROM ATABLE A, BTABLE B WHERE ( (B.X = '011170' AND B.Y = A.W) ) AND A.FYEAR = '2008' AND A.FPRNO='3' Then it returns data. Since (B.X = '011170' AND B.Y = A.W) is true and (C.M = A.Z AND C.N = A.T) is false, shouldn't the compound statement in the parenthesis in the first one, separated by an OR, yields true, and so should yield data? It is acting as if (true or false) ===> false rather than true. |
#6
| |||
| |||
|
|
If table C is empty, there are no records in the join, so the WHERE clause is never evaluated. |
#7
| |||
| |||
|
|
If table C is empty, there are no records in the join, so the WHERE clause is never evaluated. |
#8
| |||
| |||
|
|
If table C is empty, there are no records in the join, so the WHERE clause is never evaluated. |
#9
| |||
| |||
|
|
If table C is empty, there are no records in the join, so the WHERE clause is never evaluated. |
![]() |
| Thread Tools | |
| Display Modes | |
| |