Marco Keuthen wrote 

> Hi, 
> perhaps someone could give me a clue :-) 
> I have three tables: 
> SELECT
> T1.Field1,
> T2.Field2,
> T2.Field2,
> T3.Field2, 
> They have a 3er key.
> T1.Field2 is the foreign key for T2.Field1,
> T2.Field2 is the foreign key for T3Field1 
> If I do: 
> SELECT
> T1.Field1,
> T2.Field3,
> T3.Field3 
> FROM
> T1 LEFT OUTER JOIN T2 ON (T1.Field2 = T2.Field1) LEFT OUTER JOIN
(T2.Field2 = T3.Field1)
> ... 
> I get an error. (Invalid end of SQL...) 
> How do I handle a chained dependency in SAPDB?
> I want all the records in T1, even if T2 or T3 hasn't a correct value, so 
> SELECT
> T1.Field1,
> T2.Field3,
> T3.Field3 
> FROM
> T1,
> T2,
> T3 
> WHERE
> T2.Field1 = T1.Field2 AND T3.Field1 = T2.Field2 
> wouldnt do the job. 

The first syntax is not finaly implemented in sapdb.
Sapdb uses a more oracle like syntax for outer joins.
So try this command with oracle outer join syntax and 
from select: 

SELECT
 T1.Field1, TR.F2, tr.f3 
FROM
 T1, (select T2.Field1 f1, T2.Field3 f2, T3.Field3 f3 
      from T2, T3
      where T3.Field1(+) = T2.Field2) tr
WHERE
 TR.F1 (+) = T1.Field2 !

HTH.
Holger
SAP Labs Berlin
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to