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