Oracle根据条件统计数据

Oracle根据条件选择数据进行统计,当某字段条件等于One或者等于Two就自动加1,

1可以选择表t1的为数字的字段

select t1.ord,sum(case  when t1.ttype='One' or t1.ttype = 'Two' then 1 end) adultNum

from Table1 t1 group by t1.ord

猜你喜欢

转载自tiramisu110.iteye.com/blog/2221336