I have a table with some data that has gone wrong, that I need to fix up. Below is an example:
TABLE-A
id, type, value
1, 10, 123456
2, 10, NULL
3, 10, NULL
4, 20, 123456
5, 20, 654321
6, 20, NULL
I need a MYSQL update command.
If the "type" is the same then update the "value" so it is the same as long as the value is NULL and the "value" is unique
UPDATE table-a SET value = (...)
So in the table above only id 2 and 3 will have the value updated to 123456
id 6 will not update as the "value" is not unique for the the same "type".