update da_czk set ye=ye-zckxf.xf from
(select id as card_no ,sum(amt) as xf from xs_003 where id'' andbdate='2007-03-08'
group by id
) zckxf where da_czk.card_no=zckxf.card_no
select id as card_no ,sum(amt) as xf from xs_003 where id'' and bdate='2007-03-08' group by id 第一我们先看这句话:这是用id分组,取 amt字段的和,且id不能为空,和日期bdate是2007-03-08的.这个查询可以出来一个结果集合,我们给他起名为:zckxf这样我们的sql语句就变成了:update da_czk set ye=ye-zckxf.xf from zckxf where da_czk.card_no=zckxf.card_no这样我们就能看懂了通过card_no把da_czk和我们刚才取的结果集(z...
update da_czk set ye=ye-zckxf.xf from (select id as card_no ,sum(amt) as xf from xs_003 where id'' and bdate='2007-03-08' group by id ) zckxf where da_czk.card_no=zckxf.car...