Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> SQL puzzle -- flattening a parent child relationship

SQL puzzle -- flattening a parent child relationship

From: John Pink <jpink_at_liquidaudio.com>
Date: 2 Apr 2002 17:07:30 -0800
Message-ID: <5d5e9a4d.0204021707.35dcc3c9@posting.google.com>


There are a few threads on this issue, but none really answer this question:

I have 2 tables:

parent:
ID VALUE

1       A
2       B

child:
ID     VALUE
1        X
1        Y
1        Z
2        X
2        Y

Is it possible using just (Oracle) SQL to join these tables and return a single record for each parent? The desired results for this example are:

1,A,X,Y,Z
2,B,X,Y

I have considered using an inline view to flatten the child into:

1,X,Y,Z
2,X,Y

which would seem to solve the problem, but don't have a solution for that either.

Clearly this is a non-issue using any variety of programming constructs, but I'd like to do it in "pure" SQL and don't even know if it is possible.

Thanks for your help,

John Received on Tue Apr 02 2002 - 19:07:30 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US