使用新id将一个表中的值INSERT到另一个表,并将新id复制到另一个表

时间:2017-10-30 13:23:38

标签: mysql mysql-5.5

我有SQL查询:

INSERT INTO users (name, username, email, params, password )
SELECT CONCAT (`IMIE_WL`,' ', `NAZ_WL`), 
       CONCAT (a.wid,'-',LPAD(a.cid, 4, '0') ,'-',LPAD(a.LP_H, 2, '0')),
       b.AK_NAZWA,
       CONCAT('{"language":"","helpsite":""}'),
       CONCAT('SomePasswordSalted')
FROM   source_data AS b
INNER JOIN loginy AS a ON a.ID_LOK = b.ID_LOK;

我需要在此查询中添加另一个插件,如下所示:

INSERT INTO conector (id,ID_LOK) VALUES (LAST_INSERT_ID(),ID_LOK);

一个查询的任何想法?

0 个答案:

没有答案