I have a table tha contains 3 rows like:
P_K, Group, Name, Age:
1, 1, Alice, 35
2, 1, Bob, 40
3, 2, Eva, 19
4, 2, Carl, 20
And I want (if possible) with 1 MySQL query to update Alice's age and delete Bob.
My first approach was to execute a delete query on group 1, and then insert the rows that I want. (1, Alice, 36)
Later on I found an other approach, which was to add an extra column with a timestamp or a number, and during the upsert update this column. Then delete the rows that not mach the latest number.
Is there something else that I can do? That doesn't demand an extra column or 2 queries?