You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 18, 2021. It is now read-only.
Dear, to return the field of auto increment of my table, currently I need to make a select with the data that were inserted to search for this information.
Somehow, it would be possible, when making an insertion, to return the line added in the database so that I can retrieve data such as auto increment fields and fields updated by internal triggers.
In my case, I need to return id AUTO_INCREMENT and created_time DATETIME
insert_into returns the id. So I would use that one for the subsequent select.
Other than that, I don't know of a way that MySQL can yield inserted data as part of the insert call? PostgreSQL has the RETURNING clause. But I don't think there is an equivalent for MySQL?
In MySQL I can use triggers to change data in tables during insert / update, for example, when inserting a new record the created_time field is filled with the current date and time.
insert_into returns the auto increment fields id ? I will test this, thanks :)
Dear, to return the field of auto increment of my table, currently I need to make a select with the data that were inserted to search for this information.
Somehow, it would be possible, when making an insertion, to return the line added in the database so that I can retrieve data such as auto increment fields and fields updated by internal triggers.
In my case, I need to return
id AUTO_INCREMENT and created_time DATETIME
My actual code is:
The text was updated successfully, but these errors were encountered: