sql一道笔试题
表test结构:
group score
a 胜
b 负
a 负
b 胜
检索结果:
组 胜 负
a 1 1
b 1 1
sql:
select group as '组',count(case when score='胜' then score end) as '胜'
,count(case when score='负' then score else null end ) as '负'
from test group by group
,count(case when score='负' then score else null end ) as '负'
from test group by group
上一篇:没有文章了
名字:
全部评论:
loading...
申明:本站部分文章来自网络,由于各种原因对文章的来源无从考究,如果您是“
sql一道笔试题
”的原作者,若侵犯您的版权,请与我联系!联系方法:email:ahuinan@21cn.com QQ:106494262
文章档案
- 作者:佚名
- 来源:转载
- 日期:2011/12/18 22:31:00
- 点击:loading...
网友投票(您觉得这篇文章怎样?)
请稍侯......
请稍侯......