日期:2014-05-17 浏览次数:20656 次
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 h from 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 h from 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 h from T1