mysql用变量存储插入的id
INSERT into a(value) values ('test');
#set @last_id = LAST_INSERT_ID();
set @last_id = (select max(id) from a);
INSERT INTO b (a_id, `value`) values (@last_id, 'aaaa');
INSERT INTO b (a_id, `value`) values (@last_id, 'tetete');
INSERT into a(value) values ('bbbtest');
set @last_id = (select max(id) from a);
INSERT INTO b (a_id, `value`) values (@last_id, 'aaaa');
INSERT INTO b (a_id, `value`) values (@last_id, 'tetete');