mysql里的判断,截取

Posted on 2010-03-23 16:08 追梦人 阅读(180) 评论(0)  编辑  收藏 所属分类: mysql
select dr.name, round(sum(dr.killed)/((case sum(dr.deaded) when 0 then 1 else sum(dr.deaded) end)), 2) ,round(avg(dr.assists), 2) from dota dr where dr.type=3 group by dr.name


case sum(dr.deaded) when 0 then 1 else sum(dr.deaded) end 当sum(dr.deaded)为0时取1,否则取本身

只有注册用户登录后才能发表评论。


网站导航: