Quote: 引用:完善一下:select sum(case when (a>0 and b>0) or (a>0 and c>0) or (a>0 and d>0) or (a>0 and e>0) or (a>0 and f>0) or (a>0 and g>0) or ... then h else 0 end) as hfrom T1将条件放在后面也是一样的。也就是说一定要将条件一个个写出来吗?没有别的办法啦?
完善一下:select sum(case when (a>0 and b>0) or (a>0 and c>0) or (a>0 and d>0) or (a>0 and e>0) or (a>0 and f>0) or (a>0 and g>0) or ... then h else 0 end) as hfrom T1
select sum(case when (a>0 and b>0) or (a>0 and c>0) or (a>0 and d>0) or (a>0 and e>0) or (a>0 and f>0) or (a>0 and g>0) or ... then h else 0 end) as hfrom T1