爪哇一角

共同探讨STRUTS#HIBERNATE#SPRING#EJB等技术
posts - 3, comments - 6, trackbacks - 0, articles - 99
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

case when 用法

Posted on 2010-01-28 16:14 非洲小白脸 阅读(281) 评论(0)  编辑  收藏 所属分类: oracle
select
NVL(sum(case when n.type='OK' then n.nums else 0 end),0) as nums
from XX n

结果:统计得到type=OK的所有记录的nums。


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


网站导航: