I am working on a query that I'd like to run to import some phrases based on actions.
These are the two tables I want to insert data into.
actions:
- id
- name
- data
phrases:
- id
- action_id
- phrase
Where phrases.action_id = actions.id
I want to create a new action. Return that ID and then add multiple phrases using the returned ID.
Is there anyway of making the action.id that was inserted persistent or a variable for re-use.
My train of thinking has led me to things like:
SELECT LAST_INSERT_ID();
And
OUTPUT insterted.id
Not expecting an answer but some helpful information that will point me in the right direction would be great