I have a table PersonalInfo
having columns such as Id, Name, Address
.
Suppose I have following data
1 John US
2 Mark UK
3 John UK
4 David US
Now when I insert following new record
5 John China
I want to update the last record having same name as the new one for example as shown here the record 3 John UK
will be updated to 3 John China
.
When I insert the 5th record the table should be
1 John US
2 Mark UK
3 John China
4 David US
5 John China
what sql query should I use?