質問があります
INSERT INTO ... SET ....;
SET @last_id = LAST_INSERT_ID();
INSERT INTO ... SET .... ,item_id = @last_id;
INSERT INTO ... SET .... ,item_id = @last_id;
そして、変数の結果値に出力したい。例えば:
SELECT @last_id as ID;
クエリ:
INSERT INTO `targets` SET `name` = '123';
SET @target_id = LAST_INSERT_ID();
SELECT @target_id as id;