Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> oracle cross table
I have the following data.
Name Age Contact Amount
--------------------------------------------------------
John Smith 30 Jane Doe 10 John Smith 30 Joe Klein 10
I am trying to get this result.
Name Age Primary Contact Secondary Contact Amount
---------------------------------------------------------------------
John Smith 30 Jane Doe Joe Klein 10
I tried something like this:
Select name,age,
decode(contact,'Jane Doe','Jane Doe',NULL) Primary, decode(contact,'Joe Klein','Joe Klein',NULL) Secondary, amount,
decode(contact,'Joe Klein','Joe Klein',NULL) amount;
Any help would be really appreciated.
Sent via Deja.com http://www.deja.com/
Before you buy.
Received on Mon Jan 10 2000 - 08:53:08 CST
![]() |
![]() |