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 -> oracle cross table

oracle cross table

From: <analyst_user_at_my-deja.com>
Date: Mon, 10 Jan 2000 14:53:08 GMT
Message-ID: <85croe$66s$1@nnrp1.deja.com>


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,

From Table
Group by name,age,decode(contact,'Jane Doe','Jane Doe',NULL)
         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

Original text of this message

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