insert into table1(id,field1) (select id,string from table2 where table2field2 in (select id from table3 where table3field2=11))
只有select id,string from table2 where table2field2 in (select id from table3 where table3field2=11)这一段可以执行,但整个sql在access里通过不了,但在sql server里没问题,应该怎么改?
先得到
select id from table2 where table2field2 in (select id from table3 where table3field2=11)
存为一个变量id
然后
sql="insert into table1(id,field1) values(" & id & ",string)"
我不知道你的语法,原来应该是这样。
支持这种语法。
报什么错?
这样写:
insert into table1(id,field1) select id,string as field1 from table2 where table2field2 in (select id from table3 where table3field2=11))
最后一个括号去掉
支持的啊,哈哈,我没有用过多少,不知道,抱歉。
支持那就应该是:
insert into table1(id,field1) select id,string from table2 where table2field2 in (select id from table3 where table3field2=11)