如何通过subselect将值插入MYSQL-DB?

时间:2010-10-10 21:23:35

标签: sql oracle mysql

在oracle-db中,可以将表A中的值插入到表B中,如

Insert into table_a values
 Select * from table_b where ID = 10
;

如果结构相同。 我怎么能在MYSQL中这样做?我的编辑给了我一个sytanx错误。

Thx 4你的答案!

格尔茨

2 个答案:

答案 0 :(得分:0)

Mysql不使用values关键字:

Insert into table_a (field1, field2)
 Select field1, field2 from table_b where table_b.ID = 10;

答案 1 :(得分:0)

在oracle和mysql中:

insert into test 
select 1 from dual

不:“插入表

相关问题