non commutative condition in LEFT JOIN 'ON' clause

"Abaco Informática S.A." <[email protected]>
Newsgroups gmane.comp.db.sapdb.general
Message-ID <003a01c36278$245120c0$e02a46c8@internet2>
Try This:

CREATE TABLE T1 (COD_1 FIXED(4), VAL_1 FIXED(4))
CREATE TABLE T2 (COD_2 FIXED(4), VAL_2 FIXED(4))
CREATE TABLE T3 (COD_3 FIXED(4), VAL_3 FIXED(4))
INSERT INTO T1 VALUES (1,1)
INSERT INTO T1 VALUES (2,2)
INSERT INTO T1 VALUES (3,3)

INSERT INTO T2 VALUES (1,1)
INSERT INTO T2 VALUES (2,2)

nothing for T3.

then:

select * from t1 left join t2  on (val_1 = cod_2)  left join t3  on ( val_2 = cod_3)

3 rows (it's ok)

select * from t1 left join t2  on (val_1 = cod_2)  left join t3  on (cod_3 = val_2)

0 rows !! (It is wrong)

Watch the last 'ON' condition.

Well, that is my problem now, can somebody suggest something to fix this? or I must be carefully with the order of operands?

Thanks in advance.

Ricardo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.