I have a table named titles with 3 columns named titleID, price, and pubDate
I've been trying to change the price of a row to the same price as the row with the most recent pubDate
I have
UPDATE titles t
INNER JOIN titles t2
ON t.titleID = t2.titleID
SET
t.price = (
/*Returns the price of the titleID with the most recent date in pubID*/
SELECT t3.price FROM titles t3
ORDER BY t.pubDate DESC LIMIT 1)
WHERE t.titleID = 1001
The error I am getting is
Error Code: 1053. You can't specify target table t for update in FROM clause
How can I correctly change a value to a value from the same column