Wednesday, 25 July 2018

MySQL: Get ID of the Last Updated Row

In this post, I am sharing a demonstration on how to get last updated ID of the last updated row in MySQL.
Many times, we require updating the data basis on last updated table id.
We should write update query such a way that we can get a last updated ID in the update statement only.
Here, I am sharing different ways for getting a last updated ID of the last updated row.
Let’s first create a table with sample data. 
First script to get a last updated ID:
Get all last updated ID when more than one row updates:
Second script using LAST_INSERT_ID():
Before this, please execute the insert script again.

0 comments:

Post a Comment