update tb
  set cost=isnull(cost,1)*1.2
where call='edit.text1'select sum(cost) cost from tb-------------declare @total decimal(10,2)
set @total=0update tb
  set cost=isnull(cost,1)*1.0,
      @total=@total+cost
where call='edit.text1'

解决方案 »

  1.   

    with Query1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('update tb  set cost=isnull(cost,1)*1.2');
      SQL.Add(' where call='''+edit1.text''' ');
      ExecSQL;
    end;with Query1 do
    begin
      Close;
      SQL.Clear;
      SQL.Add('select sum(cost) cost from tb ');
      Open;
    end; 
    select sum(cost) cost from tb
      

  2.   

    select sum(cost*0.2) as cost from dbtable where call='edit.text1'自己修改部分变量
      

  3.   

    我这个是在deiphi中实现的,coet乘以费率,费率要到另外一张表里面查找,查找要Table1中的callquhao和callInquhao和Table2的callquhao和callInquhao匹配后,找到Table2中的费率,然后根据不同的费率算出不同的话费总和,还有总的话费总和。请问怎么实现啊?
      

  4.   

    select sum(col *.2)
    from T