解决方案 »

  1.   

    select  
    b.地区
    sum  (a.采购价格)  as 三甲采购总金额,
    sum(case when b.类别=1 then a.采购价格 else 0 end) as 三甲采购三类金额
    from
     A inner join  B b on a.id = b.id  
    group by
      b.地区
      

  2.   

    ------------------
    sum(case when b.类别=1 then a.采购价格 else 0 end) as 三甲采购三类金额
    如果这个b.类别=1 then  中的1是通过查询的来的,这个地方改怎么写了? b.类别=?????? then   就是说这个1是通过联合查询得出来的。