我有一个查询
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;