Update table on itself MySQL
mysql, sql, sql-update
Solution
UPDATE dlp.address AS t1
INNER JOIN
(
SELECT addressuuid, MIN(last_updated) minDate
FROM dlp.address
GROUP BY addressuuid
) AS t2
ON t1.addressuuid = t2.addressuuid
SET t1.created_on = t2.minDate
Problem
I can't figure out how to make this query run.... I want to update the table so that dependent on the uuid it grabs the lowest of the 'last_updated' and updates the 'created_on' ... I keep getting 'cant specify target table' although I don't know why =/ Is it a recursion issue? ``` UPDATE dlp.address AS t1 SET created_on = (SELECT MIN(last_updated) FROM dlp.address AS t2 WHERE t1.addressuuid = t2.addressuuid); ```