INSERT FROM SELECT
insert IGNORE into PCARD_HEADER (RECORDID) SELECT RECORDID FROM SOH;
INSERT INTO MESSAGE_HEADER (RECORDID,PARENT_RECORDID, ACTION )
SELECT RECORDID*2 , RECORDID PARENT_RECORDID , 'IMPORT' ACTION FROM VENDOR WHERE NO='-';
SET @rank:=2015021750000;
INSERT INTO VENDOR_PRODUCT (RECORDID, PARENT_RECORDID, VENDOR_NO,LAST_UPDATE)
SELECT @rank:=@rank+1 , PARENT_RECORDID, VENDOR_RECORDID, '2015-2-17' FROM DUMMY01;
delete from CODE;
SET @rank:=0;
INSERT INTO CODE (
CODE,ACCOUNT,NATURE
,STATUS
,RECORDID)
VALUES ("14020-020","Rates Deposit","Other Asset"
,"A"
, round(@rank:=@rank+1,0));
Insert into message_header
INSERT INTO MESSAGE_HEADER (RECORDID,PARENT_RECORDID, ACTION )
SELECT RECORDID*2 , RECORDID PARENT_RECORDID , 'IMPORT' ACTION FROM PRODUCT WHERE RECORDID>=2015021720000 AND RECORDID<=2015021721000;
INSERT DELAYED is that inserts from many clients are bundled together and written in one block. This is much faster than performing many separate inserts.
insert ignore into table_1 select * from table_2;
insert into table (all columns except pk) select all_columns_except _pk from table2;
insert into SALES_ORDER_HEAD select * from TEMP;
INSERT INTO SETTINGS (CODE,DESCRIPTION,RECORDID,DATA_GROUP,STATUS)
SELECT CODE,NAME,RECORDID,'manu','D' FROM MANUFACTURER;
iNSERT INTO courses (name, location, gid)
SELECT name, location, 1
FROM courses
WHERE cid = 2
沒有留言:
張貼留言