行转列。。。。
select * from (
(select tundishno,origin as a1 from 表 where strandid='1') a,
(select tundishno,origin as a1 from 表 where strandid='2') b,
(select tundishno,origin as a1 from 表 where strandid='3') c,
(select tundishno,origin as a1 from 表 where strandid='4') d,
(select tundishno,origin as a1 from 表 where strandid='5') e,
(select tundishno,origin as a1 from 表 where strandid='6') f
where a.tundishno =b.tundishno and a.tundishno=c.tundishno and a.tundishno=d.tundishno
and a.tundishno=e.tundishno and a.tundishno=f.tundishno
)
可以按这思路做。。。。
用行列转换。
select tundishno,sum(decode(STRANDID,'1', ORIGIN,null)) "1",
sum(decode(STRANDID,'2', origin,null)) "2",
sum(decode(subject,'英语', grade,null)) "3"
......
from table
group by tundishno;
你的要求好复杂。