怎么用sql语句将两竖列变成两横列呢?oracle10g的

[复制链接]
查看11 | 回复1 | 2013-10-17 11:14:59 | 显示全部楼层 |阅读模式
我举个例子:create table aa(
a number,
b number)insert into aaselect 1,2 from dualunion select 2,3 from dualunion select 3,4 from dualselect * from aa;selectsum(case b
when 2 then 1 else 0 end) c,
sum(case b
when 3 then 2 else 0 end) d,
sum(case b
when 4 then 3 else 0 end) e
...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行