oracle 多列求和


第一种:

select sum(decode(count1,null,0,count1) +decode(count2,null,0,count2)
+decode(count3,null,0,count3)) a from test_table

第二种:

select sum (case when count1 is not null then count1 when 
count2 is not null then count2 when count3 is not null 
then count3 else '0' end ) a from test_table

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM