oracle对三个列求sum
发布时间:2020-12-12 14:45:38 所属栏目:百科 来源:网络整理
导读:oracle数据库对test_table表的三个列count1,count2,count3求sum的两种sql,做个记录 第一种 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 tes
oracle数据库对test_table表的三个列count1,count2,count3求sum的两种sql,做个记录
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
select sum(decode(count1,null,0,count1) +decode(count2,count2) +decode(count3,count3)) a from test_table (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |