insert 表 select * from 表的方法主要有两种:1、若两张表完全相同: insert into table1 select * from table2 where condition(条件)2、若两张表字段有不同的: insert into table1(字段1,字段2,字段3....) select 字段1,字段2,字段3.... from table2 where condition(条件) 上述两种方法均不需要写values.
去掉values就能实现了,用了values后就不要跟select语句
insert into news (newsid, ColumnId,NewsName,newscontent) select 400,8,'ww',newscontent from news where newsid=347
select * from table2; --table1和table2相同insert into table1
select col1,col2,col3.... from table2;
不加values
select 字段1,2,3,..N from table2
字段数要对应起来就可以了。
select * from table2;insert into table1
select col1,col2,col3.... from table2;
这样应该行的,我试过了
insert into table1
select * from table2
where condition(条件)2、若两张表字段有不同的:
insert into table1(字段1,字段2,字段3....)
select 字段1,字段2,字段3....
from table2
where condition(条件) 上述两种方法均不需要写values.
select 400,8,'ww',newscontent from news where newsid=347