wasp256
wasp256

Reputation: 6242

Oracle SQL hierarchical query with two tables

I have two tables with the following structure

Table 1:

PRODID |   PSTID  |
___________________
 1     |    4
 2     |    
 3     |    2 
 4     |    
 5    |    

Table 2:

PSTID   |  PRODID
_______________
 1      |   4
 2      |   1
 3      |   1
 5      |   

Upvotes: 1

Views: 445

Answers (1)

MT0
MT0

Reputation: 167822

SELECT t1.*
FROM   table1 t1
       INNER JOIN
       table2 t2
       ON ( t1.prodid = t2.prodid )
START WITH t1.prodid = 1
CONNECT BY PRIOR t2.pstid = t1.pstid;

Upvotes: 3

Related Questions