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

Home -> Community -> Usenet -> c.d.o.tools -> Help with DECODE

Help with DECODE

From: Tim McNamara <dirk_diggler_69us_at_yahoo.com>
Date: Sat, 04 Aug 2001 13:13:21 GMT
Message-ID: <RxSa7.15783$Jg.2212483@typhoon.kc.rr.com>

I am trying to transpose the following:

id seq comment comment_dt ----- ----- ------------ ------------

1         1          comment_1   date_1
1         2          comment_2   date_2
1         3          comment_3   date_3
2         4          comment_4   date_4
2         5          comment_5   date_5

and desire to transpose the data thus (selecting the two most recent comment dates for each id):

id       comment_1      comment_dt_1    comment_2    comment_dt_2
-----  ------------      ------------         ------------   ------------
1       comment_1       date_1                comment_2    date_2
2       comment_3       date_3                comment_4    date_4

Fumbled around with DECODE and rownum to no avail. Could someone enlighten a SQL novice

Much appreciated...

Tim Received on Sat Aug 04 2001 - 08:13:21 CDT

Original text of this message

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