语句形式为:Insert into Table2(field1,field2,...) select value1,value2,... from Table1
要求目标表Table2必须存在,由于目标表Table2已经存在,所以我们除了插入源表Table1的字段外,还可以插入常量。示例如下:
举例:Insert into Table2(a, c, d) select a,c,5 from Table1
INSERT INTO coupon_item_good_admin_user
( couponItemGoodId, couponAdzoneId, pubAdminId, pubAdminName, volume,
cdate, udate, status)
SELECT c.id,c.couponAdzoneId,c.createAdminId,c.createAdminName,0, now(),now(),1
from coupon_item_good c;
1.2、select into
SELECT vale1, value2 into Table2 from Table1
要求目标表Table2不存在,因为在插入时会自动创建表Table2,并将Table1中指定字段数据复制到Table2中。示例如下:
举例select a,c INTO Table2 from Table1
select ename,sal,job into pname,psal,pjob from emp where empno = eno;
前言1、insert语句1、Insert into 语句形式为:Insert into Table2(field1,field2,...) select value1,value2,... from Table1要求目标表Table2必须存在,由于目标表Table2已经存在,所以我们除了插入源表Table1的字段外,还可以插入常量。示例如下:举例:Inser...