34,576
社区成员
发帖
与我相关
我的任务
分享
update tableA
set tableA.bz=tableB.bz
from tableA inner join tableB on tableA.jh = tableB.jh and tableA.rq = tableB.rq and
tableB.rq>='2008-4-1' and tableB.rq<='2008-4-9'
update tableA
set tableA.bz=tableB.bz
from tableA inner join tableB on tableA.jh = tableB.jh and tableA.rq = tableB.rq and
tableB.rq>=#2008-4-1# and tableB.rq<=#2008-4-9#
Access中不允许用where tableA.fieldA = TableB.fieldA 来做update的连接,这是T-sql的语法,必须把t-sql的语法转成Asni的语法,用 join 来做。
对查询结果关联,access必须把查询分成两部分,最后把临时表删:
-------------------------------------------------------------------------
select fid,sum(sl) as sumsl from aa into bb where bs=1 group by fid;
update aa inner join bb
on aa.id=bb.fid
set aa.sl=bb.sumsl
drop table bb
update tableA,tableB
set tableA.bz=tableB.bz
where tableA.jh = tableB.jh and tableA.rq = tableB.rq and
tableB.rq>=#2008-4-1# and tableB.rq<=#2008-4-9#
UPDATE tableA SET bz = dlookup("bz","tableB","rq>=#2008-4-1# and rq <=#2008-4-9# AND jh='" & tableA.jh & "' AND rq=#" & tableA.rq & "#");