首页 > 代码库 > ORACLE 按表字段值的不同统计数量
ORACLE 按表字段值的不同统计数量
select p.id comperitorId,p.compcorp competitorName, sum(case when c.kindname = 'ATM' then c.num else 0 end) atm, sum(case when c.kindname = 'CRS' then c.num else 0 end) crs, sum(case when c.kindname = 'VTM' then c.num else 0 end) vtm, sum(case when c.kindname = '清分机' then c.num else 0 end) sorter, sum(case when c.kindname = '软件' then c.num else 0 end) software, sum(case when c.kindname = '其它' then c.num else 0 end) other, m.iscommunication iscommunication from compproduct c join competitor p on c.competitor_id=p.id join (select f.custid,t.companyid,t.iscommunication from technologycompany t join technology_flow f on f.id=t.flowid) m on c.competitor_id=m.companyid and c.cust_id=m.custid where c.cust_id='7649' group by p.id,c.competitor_id,p.compcorp,m.iscommunication
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。