select b.name,sum(b.数量*a.价格) from 产品表 a,购买表 b
where a.单号=b.单号
group by b.客户名称
having(sum(b.数量*a.价格)>1000)

解决方案 »

  1.   

    select 客户名称,sum(数量*价格) as 购买金额 from 客户购买表 ,产品表 
    group by 客户名称  having sum(数量*价格)>1000
      

  2.   

    晕,太慢乐,而且还错乐
    select 客户名称,sum(数量*价格) as 购买金额 from 客户购买表 a inner join 产品表 b on 
    a.单号=b.单号
    group by 客户名称  having sum(数量*价格)>1000
      

  3.   

    select b.客户名称,价格和=sum(a.价格*b.数量) from 产品表 a join 客户购买表 b
    on a.单号=b.单号
    group by b.客户名称  
    having sum(b.数量*a.价格)>1000