Rexroth
Rexroth

Reputation: 109

Oracle - Join operation with table aliases

I have 3 Table A B and C. I want to firstly process Table A and B to create a table 'AB' then join the result of that to C. Here is what I have in mind:

select C.number, C.class, AB.name
from C,
  (select A.name, A.number
  from A
  FULL OUTER JOIN B
  ON A.number = B.number) AB
FULL OUTER JOIN AB
ON AB.number = C.number

However it doesn't seem to be working. Now I am not sure if giving the result of A&B an alias works in Oracle DB. How should this be done the correct way?

Upvotes: 0

Views: 230

Answers (1)

mucio
mucio

Reputation: 7119

 SELECT C.number, 
        C.class, 
        AB.name
 FROM C
 FULL OUTER JOIN
             (SELECT A.name, 
                     A.number
              FROM A
              FULL OUTER JOIN B
              ON A.number = B.number) AB
   ON AB.number = C.number

Upvotes: 1

Related Questions