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

Home -> Community -> Usenet -> c.d.o.server -> Combining Rows

Combining Rows

From: Brian Y. <NOSP_at_M>
Date: Fri, 16 Feb 2001 02:23:00 GMT
Message-ID: <8a0j6.45$MX.272841@news2.news.adelphia.net>

Here's a dilemma. I need to combine rows in such a way that I break values from the rows into separate columns. I know there's a better way to present the data, but this is what's required. Consider these two tables...

Table1



ID Name
1 Joe
2 Fred
3 Lisa

and

Table2



ID ItemID Amount
1   1         20
1   2         40
1   3         30
2   1         10
2   2         10
2   3         50
3   1         25

I need to link the tables and combine the rows in such a way that I get this...

ID Amount1 Amount2 Amount3

1  20      40      30
2  10      10      50

3 25

Any thoughts on query syntax that will do this? This is Oracle 8i. Thanks in advance.

B~ Received on Thu Feb 15 2001 - 20:23:00 CST

Original text of this message

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