
(注意:输出结果里NAME列的lee要求小写)
create table tab8(
name varchar2(10),
type varchar2(20),
value number(2)
);
insert into tab8(name, type, value) values ('lee', 'Breakfast', 10);
insert into tab8(name, type, value) values ('Lee', 'Lunch', 20);
insert into tab8(name, type, value) values ('Lee', 'Supper', 20);
commit;
with t1 as
(select lower(t.name) name, t.type, t.value from tab8 t)
select *
from t1
pivot (sum(value) for type in('Breakfast' as Breakfast,
'Lunch' as Lunch,
'Supper' as Supper));


640

被折叠的 条评论
为什么被折叠?



