日期:2014-05-17  浏览次数:20801 次

新人求这SQL面试题答案


前三个都比较简单
但第四个问题,怎样转变表的格式啊,哪位大哥帮忙做一下

------解决方案--------------------
select name as "姓名",
(select result from CJ where name=t.name and subject='语文') as "语文",
(select result from CJ where name=t.name and subject='数学') as "数学",
(select result from CJ where name=t.name and subject='英语') as "英语",
from CJ t
group by name