select aa,max(decode(bb,'a',cc)) a,max(decode(bb,'b',cc)) b,max(decode(bb,'c',cc)) c,max(decode(bb,'d',cc)) d from table group by aa
select aa,max(decode(bb,'a',cc)) a,max(decode(bb,'b',cc)) b,max(decode(bb,'c',cc)) c,max(decode(bb,'d',cc)) d from table group by aa
select aa, max(decode(bb,'a',cc)) a, max(decode(bb,'b',cc)) b, max(decode(bb,'c',cc)) c, max(decode(bb,'d',cc)) d from tab group by aa
with tb as( select 1 aa,'a' bb,1 cc from dual union all select 1,'b',3 from dual union all select 1,'c',4 from dual union all select 2,'a',5 from dual union all select 2,'b',2 from dual union all select 2,'c',6 from dual union all select 2,'d',5 from dual) select aa, max(decode(bb,'a',cc,null)) a, max(decode(bb,'b',cc,null)) b, max(decode(bb,'c',cc,null)) c, max(decode(bb,'d',cc,null)) d from tb group by aa / AA A B C D --------- ---------- ---------- ---------- ---------- 1 1 3 4 2 5 2 6 5
select aa,max(decode(bb,'a',cc)) a,max(decode(bb,'b',cc)) b,max(decode(bb,'c',cc)) c,max(decode(bb,'d',cc)) d from table group by aa
from table
group by aa
from table
group by aa
max(decode(bb,'a',cc)) a,
max(decode(bb,'b',cc)) b,
max(decode(bb,'c',cc)) c,
max(decode(bb,'d',cc)) d
from tab
group by aa
select 1 aa,'a' bb,1 cc from dual
union all
select 1,'b',3 from dual
union all
select 1,'c',4 from dual
union all
select 2,'a',5 from dual
union all
select 2,'b',2 from dual
union all
select 2,'c',6 from dual
union all
select 2,'d',5 from dual)
select aa,
max(decode(bb,'a',cc,null)) a,
max(decode(bb,'b',cc,null)) b,
max(decode(bb,'c',cc,null)) c,
max(decode(bb,'d',cc,null)) d
from tb
group by aa
/
AA A B C D
--------- ---------- ---------- ---------- ----------
1 1 3 4
2 5 2 6 5
from table
group by aa