Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Help with DECODE
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
![]() |
![]() |