I need to find an equivalent in MySQL for the RETURNING functionality in PostgreSQL (for INSERT INTO). LAST_INSERT_ID() does not work because the id is not auto-incrementing, and is instead generated by a subquery. Because of the delay between the single queries allowed by PDO, I would like to implement this in a single line without table-locking so as to keep the table available.
How about to add a dummy auto-incremental primary key? Then, the process will not be done by single query, but can be done without explicit table-locking.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With