I'm attempting one large query rather than several smaller ones. Firstly I'm inserting into one table and grabbing it's row ID to insert into another, for multiple rows. Is there anyway to do this?
Is there a better method of multiple inserts than I'm currently doing? Writing the same insert into several times feels like overkill.
Code:
INSERT INTO `users notes` (`text`)
VALUES ('blah blah some text here');
INSERT INTO `users exercises` (`userid`, `exerciseid`, `time`, `weight`, `distance`, `reps`, `intensity`, `notes`)
(1, 188, 1, NULL, NULL, NULL, NULL, last_insert_id()),
(1, 188, 1, NULL, NULL, NULL, NULL, last_insert_id());
INSERT INTO `users notes` (`text`)
VALUES ('blah blah some text here');
INSERT INTO `users exercises` (`userid`, `exerciseid`, `time`, `weight`, `distance`, `reps`, `intensity`, `notes`)
(1, 188, 1, NULL, NULL, NULL, NULL, last_insert_id()),
(1, 188, 1, NULL, NULL, NULL, NULL, last_insert_id());
etc.