| A Join with more than on table [message #563717] |
Thu, 16 August 2012 10:57  |
 |
bennani1974@hotmail.com
Messages: 7 Registered: August 2012
|
Junior Member |
|
|
Hi everybody
I use a table taht i call C where the value of a field ("Type") is always a concat of values coming from more than 2 tables (A et C)
select A.Numero, B.date, B.commentaire,C.Libelle
from A, B, C
where A.codeLibelle = C.codeLibelle
and CONCAT(A.Numero, CONCAT(A.DemNumero, C.Libelle)) = B.Type (+)
when i execute this statement, i obtain
ORA-01417: a table may be outer joined to at most one other table
I have another request where it works fine and where i have concat of fields from only a single table:
select A.Numero, B.date, B.commentaire,C.Libelle
from A, B
where CONCAT(A.Numero, A.DemNumero) = B.Type (+)
In the first request Oracle seems to not accept a join with more than 2 tables
Thanks for help
Laymo
|
|
|
|
|
|
|
|
|
|
| Re: A Join with more than on table [message #563726 is a reply to message #563723] |
Thu, 16 August 2012 11:33   |
Solomon Yakobson
Messages: 1398 Registered: January 2010
|
Senior Member |
|
|
In second example B.Type is compared to expression involviong single table A while in first example B.Type is compared to expression involviong two tables A and C. Therefore second example fails. Use either:
select D.Numero,
B.date,
B.commentaire,
D.Libelle
from (
select A.Numero,
A.DemNumero,
C.Libelle
from A,
C
where A.codeLibelle = C.codeLibelle
) D,
B
where CONCAT(D.Numero,CONCAT(D.DemNumero,D.Libelle)) = B.Type(+)
/
Or use ANSI joins:
select A.Numero,
B.date,
B.commentaire,
C.Libelle
from A
join
C
on A.codeLibelle = C.codeLibelle
left join
B
on CONCAT(A.Numero,CONCAT(A.DemNumero,C.Libelle)) = B.Type
/
SY.
|
|
|
|
|
|
|
|
| Re: A Join with more than on table [message #563744 is a reply to message #563742] |
Thu, 16 August 2012 13:42  |
Solomon Yakobson
Messages: 1398 Registered: January 2010
|
Senior Member |
|
|
Prove it.
SQL> select A.Numero,
2 B.dt,
3 B.commentaire,
4 C.Libelle
5 from A
6 join
7 C
8 on A.codeLibelle = C.codeLibelle
9 left join
10 B
11 on CONCAT(A.Numero,CONCAT(A.DemNumero,C.Libelle)) = B.Type
12 /
no rows selected
SQL>
As you can see, not errors, I just have no data in the tables.
SY.
P.S. Post your full version.
|
|
|
|