求助!! 多表分组查询统计
高手们,帮帮忙!
用户表 D_user 为
ID Username GroupID
1  张三      2
2  李四      2
3  王五      2
文章表 D_article 为
ID  inputer verific(是否采纳 1为是)
1   张三    1
2   张三    0
3   张三    1
4   王五    1
问题:
我要统计 GroupID 为 2的 用户投稿排行
输出格式为
用户  投稿  采纳  录用率
张三   10    9      90%
李四   10    8      80%
.......................................
请高手指教!!!
------解决方案--------------------select a.Username,
count(b.verific) as 投稿,
sum(case when b.verific=1 then 1 else 0 end) as 采纳,
cast(((cast(sum(case when b.verific=1 then 1 else 0 end) as float)/cast(count(b.verific) as float))*100) as int) as 录用率 
from D_user a inner join D_article b on a.Username=b.inputer 
where a.GroupID=2
group by a.Username
------解决方案--------------------早点不说
access的话,把case when 转成iif