Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Selecting rows as columns
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