[Access-update语法问题]
update biaoA set A = (select B from biaoA where id=zzz) where id=xxxx
ASP查询更新Access一个表的字段的值来自同表中另一行的值,只能写成一个次查询或者说只能一次查询.上面的语法会提示语法错误.有办法在一个语句中实现吗?
[解决办法]
先查出一个值,然后再用UPDATE,ACCESS不支持你写的语句
[解决办法]
update biaoA a,biaoA b set A.a = B.b where b.id=zzz and a.id=xxxx
[解决办法]
--域函数
update biaoA set A = dlookup( "B ", "biaoA ", "id= 'zzz ' ")
where id= 'xxxx '
--或子查询
update biaoA as t1 ,(select B from biaoA where id= 'zzz ') as t2
set t1.A=t2.b
where id= 'xxxx '
[解决办法]
在ACCESS中可以用域函数:
update biaoA set A = dlookup( "B ", "biaoA ", "id= 'zzz ' ") where id= 'xxxx '
[解决办法]
但是对于有聚合函数的子查询,不能使用。
需要用域函数或借助临时表处理。