赞
踩
基本用法将select后的数据直接追加到table1的后面
insert into table1(name,code)
select name ,code from table2;
1、如果table1后面没有字段,那么就是select 必须是所有字段,包括主键(通常情况是自增主键)
2、指定字段,只和指定字段的顺序有关,和select出来的数据无关,即下面的语句,会把selec中的code字段值填充到name中。
insert into table1(name,code)
select code,name from table2;
注意:insert into 后面制定的字段会安装字段名称的顺序填充到表中
3、没有指定字段,填充的顺序就是按照字段的属性来的
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。