行转列
select
(select sum(c.integral) from score c where c.ctype=s.ctype and c.ctype='数学') as 数学,
(select sum(c.integral) from score c where c.ctype=s.ctype and c.ctype='语文') as 语文
from score s group by s.ctype
这一句错在那里
表结构是
cd ctype integral
1 数学 22
1 语文 33
2 数学 22
2 语文 33
3 数学 22
3 语文 33
(select sum(c.integral) from score c where c.ctype=s.ctype and c.ctype='数学') as 数学,
(select sum(c.integral) from score c where c.ctype=s.ctype and c.ctype='语文') as 语文
from score s group by s.ctype
这一句错在那里
表结构是
cd ctype integral
1 数学 22
1 语文 33
2 数学 22
2 语文 33
3 数学 22
3 语文 33
...全文


