Good day.
I insert data (which, perhaps, is already repeated in the table), and they are assigned the key id. How can I get the id of the string in the next query in order to work with the id further?
Thank!
Good day.
I insert data (which, perhaps, is already repeated in the table), and they are assigned the key id. How can I get the id of the string in the next query in order to work with the id further?
Thank!
MySQL LAST_INSERT_ID ()
PostgreSQL Add RETURNING "FILE_NAME" to the query and you will get back the value of the FILE_NAME field of the new record.
In MS SQL, for example:
select scope_identity() to get the last id created in the current connection and only the current scope (triggers and functions are ignored).select @@identity to get the last id created on the current connection regardless of the scope (triggers and functions are taken into account).select ident_curent('tablename') to get the last id on a specific table created on any connection.Source: https://ru.stackoverflow.com/questions/390882/
All Articles