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 -> Re: tricky SQL

Re: tricky SQL

From: bcjm <oldcar_at_hotmail.com>
Date: 4 Mar 2005 07:05:56 -0800
Message-ID: <1109948756.491657.115600@o13g2000cwo.googlegroups.com>


Thanks. I figure out the answer.

select p,

max(decode(rn, 1, c)) test1,
max(decode(rn, 1, g)) grade1,
max(decode(rn, 2, c)) test2,
max(decode(rn, 2, g)) grade2,
max(decode(rn, 3, c)) test3,
max(decode(rn, 3, g)) grade3
from (select p, c, g, row_number() over (partition by p order by c) rn
       from t1)

 group by p Received on Fri Mar 04 2005 - 09:05:56 CST

Original text of this message

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