How to get the ID immediately after inserting a new record?


I have an insert query that inserts a record into my table. This works.
When the user clicks the button to insert, it inserts the record, and then moves along my stepped container.

I'd like, at this point. to insert a related record (which is a child of the newly created record). But, to do this, I need the ID of the newly created record.

How do I do this? I've been using the GUI method for my insert query, but I also tried to do it via SQL - after reading some similar posts on this:

INSERT INTO company (company_name, sector_id, country_id)
VALUES ('{{company_name.value}}', '{{sector_id.value}}', '{{country_id.value}}')

But this didn't really work.
Any help is appreciated - as you can see, i'm a 'low-coder' :slight_smile:

I managed ot figure this out - I can access the results directly using this code: