select (Prices-sum(gongji)) from taborder_clild,Taborders where Taborders.OrderCode=taborder_clild.O_code group by taborder_clild.O_code出错,不能计算,,不能有合计函数,,,该怎么改

解决方案 »

  1.   

    taborder_clild.O_code是表的里列吗?
      

  2.   


    select sum(Prices) as gongji from taborder_clild,Taborders where Taborders.OrderCode=taborder_clild.O_code group by taborder_clild.O_code 
      

  3.   

    我是想让prices 字段 减去 gongji 字段 的合计
      

  4.   

    select Prices-s from Taborders a,(select O_code,sum(gongji) s from Taborder_child group by O_code) b
    where a.OrderCode=b.O_code
      

  5.   

    方法很多
    6楼的可以.SELECT Prices-(SELECT sum(gongji)) FROM taborder_clild WHERE O_code=A.OrderCode)
    FROM  Taborders A