oracle 中sum 函数 case when 一个条件 怎么去除其中 重复的 id值。。例如:sum(case when t1.state=1 then 1 else 0 end)
直接用count(distinct case when t1.state=1 then id end )
没看懂问题,查询时候去除重复用distinct吧