Du kan bruge LAST_INSERT_ID () funktion. Prøv dette:
INSERT INTO blahblah (test1, test2) VALUES ('test1', 'test2');
SELECT LAST_INSERT_ID() INTO @blahblah;
INSERT INTO blahblah2 (test1, test2) VALUES ('test1', 'test2');
INSERT INTO blahblah3 (test1, test2, lastid) VALUES ('test1', 'test2', @blahblah);