判断average的RecordCount,如果大于0就用Insert,否则就用Update

解决方案 »

  1.   

    可以告诉怎么改吗?
    我是个菜鸟,才解除delphi,很多都不知道!谢谢了!
      

  2.   

    应该是这句sql语句有问题
    请拿到查询分析器中执行检查分析。
    'insert into average(A0101,dept_id,average_cent) SELECT a.a0101, a.dept_id, AVG(a.true_cent * b.per) AS average_cent FROM standrd b,person a where b.dept_id = a.dept_id AND b.standard_name = a.standard_name GROUP BY a.a0101, a.dept_id'
      

  3.   

    例如 :if average.recordcount>0 then 
    begin
    {insert}
    end
    else begin  {update}