I didn't know how to clearly title this.
After joining a table on itself using shared_id I get the following data.
a.id | a.shared_id | a.key | a.value | b.id | b.shared_id | b.key | b.value
198131 | 6044 | unique-id | E15SJOEMGRMH013 | 198281 |6044 | _unique_id |
This is the result from:
SELECT * FROM
(SELECT * FROM table1 WHERE key='unique-id') AS a
JOIN
(SELECT * FROM table1 WHERE key='_unique_id') AS b
ON a.shared_id = b.shared_id
WHERE a.value!='' AND a.value!=b.value AND a.key='unique-id'
;
What I need is an update statement that will set b.value to a.values value.So in this 1 row example I want b.value to be E15SJOEMGRMH013.
Now remember a.id and b.id are NOT the same as the keys are called something slightly different but they should hold the same value. There are several hundred rows so I would like to do this in one update query.
SELECT <columns> FROM <tablename> bwithUPDATE <tablename>, and addSET b.value = a.valueat the end.