亲,我做了1小时终于整出来了。。。- select name as '姓名',sum(case subject when 'yuwen' then score else 0 end) as '语文',
- sum(case subject when 'shuxue' then score else 0 end) as '数学',
- sum(case subject when 'yingyu' then score else 0 end) as '英语' from tbl_student group by name;
复制代码 一定用case语句才有用...
我的表结构是
name varhcar(20),subject varcahr(20),score number(5).
你试试这样行不,我这行。。。
|