I've created a new column (third one) and all records are null
in that column. The table has 100 rows. When I try INSERT INTO
, records are added but only from 101 row and previous ones are still null
. That's why I decided to use UPDATE
, but I have the next error message: You can't specify target table 'actors' for update in FROM clause
Here is my query:
UPDATE
actors
SET
starred_count = (
SELECT COUNT(actors.Actor_id)
FROM starred
INNER JOIN actors ON actors.Actor_id = starred.Actor_id
GROUP BY starred.Actor_id
ORDER BY starred.Actor_id
)
How could I do this properly?