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 -> Selecting rows as columns

Selecting rows as columns

From: <bkelly01_at_hotmail.com>
Date: Tue, 16 Feb 1999 17:35:11 GMT
Message-ID: <7aca8f$1t5$1@nnrp1.dejanews.com>


Any help with the following example would be GREATLY appreciated. I am trying to use the rows in my reference table to display as columns in a view, with data from another table.

I have a the following two tables: (sample)

Table: Milestones [Reference table]

Milestone_ID    Name                Sequence
------------    --------------      ------------
1000            Registration        1
1001            Submission          2
1002            Approval            3
1003            Withdrawn           4


Table: Product_Milestones [Data table]

Prod_ID    Milestone_ID     Milestone_Date
--------   ------------     ---------------
9000       1000             1/1/1998
9000       1001             5/1/1998
9000       1002             8/1/1998
9001       1000             2/1/1998
9001       1001             3/1/1998
9001       1002             5/1/1998

What I need to do is present this data in a view that looks like this using data in the two tables above:

Prod_ID Registration Submission Approval Withdrawn
-------- ------------- ----------- --------- ----------

9000       1/1/1998       5/1/1998     8/1/1998   Null
9001       2/1/1998       3/1/1998     5/1/1998   Null


Using the DECODE function, I can get something that looks like this:

Prod_ID Registration Submission Approval Withdrawn
-------- ------------- ----------- --------- ----------

9000       1/1/1998
9000                      5/1/1998
9000                                   8/1/1998
9000                                              Null
9001       2/1/1998
9001                      3/1/1998
9001                                   5/1/1998
9001                                              Null

Any ideas???

Thanks!

Brandon Kelly

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Tue Feb 16 1999 - 11:35:11 CST

Original text of this message

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