oracle 查询 表内容如下: c1 c2 A 1 A 2 B 1 B 2 B 3 C 2 C 4
要求查询结果如下:ABC11null222null3nullnullnull4急用!!!!!!!!!!!表内容如下:c1c2A1A2B1B2B3C2C4...
要求查询结果如下:
A B C
1 1 null
2 2 2
null 3 null
null null 4
急用!!!!!!!!!!!
表内容如下:
c1 c2
A 1
A 2
B 1
B 2
B 3
C 2
C 4 展开
A B C
1 1 null
2 2 2
null 3 null
null null 4
急用!!!!!!!!!!!
表内容如下:
c1 c2
A 1
A 2
B 1
B 2
B 3
C 2
C 4 展开
1个回答
展开全部
select a.c2 a,b.c2 b,c.c2 c
from (select distinct c2 c2 from tablename)abc
left join(select c2 from tablename where c1='A') a on abc.c2=a.c2
left join(select c2 from tablename where c1='B') b on abc.c2=b.c2
left join(select c2 from tablename where c1='C') c on abc.c2=c.c2
from (select distinct c2 c2 from tablename)abc
left join(select c2 from tablename where c1='A') a on abc.c2=a.c2
left join(select c2 from tablename where c1='B') b on abc.c2=b.c2
left join(select c2 from tablename where c1='C') c on abc.c2=c.c2
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询