insert into table1 values( “数据”);
关键是这里的数据是这样的:首先一条select查询语句得到前部分的字段的值,后部分几个个字段的值是常量。
求大神指点怎么做???
------解决方案--------------------
insert into table1
select 字段,"数据" from 表
------解决方案--------------------
注意字段类型和数量必须和被插入的表一致
insert into table select t.*,"常量1“,"常量2”,"常量3" from table2 t
------解决方案--------------------
-- LZ ,给你一个例子。
create table a (id int , c1 varchar(10) , c2 varchar(10) , c3 varchar(10))
create table b (id int , c1 varchar(10))
insert into b(id , c1) values(1,'a')
-- 下面的语句,就是你想的效果,和其他人的回复也是这意思
insert into a(id , c1,c2,c3) select id , c1 , 'china','beijing' from b
select * from a