在access2000中从一表插入相关数据到另一表的sql应怎样写?(请看最后一楼,我提的问题) ( 积分: 100 )

F

fly555

Unregistered / Unconfirmed
GUEST, unregistred user!
注意:不是sql,是access2000

有表a
name b c
8 1 2
9 3 4

有表w
name b c d
8 90
9 80


现在想把表a 中对应列 b 与 c 中的值完全写入到表w中,让表w数据为
表 w
name b c d
8 1 2 90
9 3 4 80

我用这样的sql:UPDATE w SET w.b = a.b, w.c = a.c
WHERE [sfc].[personname]=[gg].[personname];
但是提示 a.b需要输入参数值 a.c需要输入参数值
应怎样写sql呢?
 
注意:不是sql,是access2000

有表a
name b c
8 1 2
9 3 4

有表w
name b c d
8 90
9 80


现在想把表a 中对应列 b 与 c 中的值完全写入到表w中,让表w数据为
表 w
name b c d
8 1 2 90
9 3 4 80

我用这样的sql:UPDATE w SET w.b = a.b, w.c = a.c
WHERE [sfc].[personname]=[gg].[personname];
但是提示 a.b需要输入参数值 a.c需要输入参数值
应怎样写sql呢?
 
update w set b=a.b,c=a.c from w inner join a on w.name=a.name
 
update w set b=a.b,c=a.c from w inner join a on w.name=a.name
 
语法错误。光标停在from 上。
 
update w set w.b=a.b,w.c=a.c from w,a where w.name=a.name
 
楼上的,还是语法错误呀。另外我想问一下:以下两种语句在access2000中报错:
操作必须是一个可更 新的查询:
1、UPDATE sfc SET 个人部分 = (select 个人部分 from gg where gg.personname = '乐乐');
2、update sfc set 个人部分 = ( select 个人部分 from gg where gg.personname =( select personname
from sfc where sfc.personname= gg.personname))
应怎样改才可以呢?
 
update w,a
set w.b=a.b,w.c=a.c
where w.name=a.name

Update sfc,(select 个人部份 from gg where personname = '乐乐') BB
SET sfc.个人部份 = BB.个人部份

第三条我就不写了,自己学学怎么写,呵,呵
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
737
import
I
I
回复
0
查看
878
import
I
顶部