UPDATE MySQL Query - Datafeed

I have three tables, let’s say: books, descriptions, datafeed.

books
±-±----+
| id | pid |
±-±----+
| 1 | p25 |
| 2 | p26 |
±-±----+

descriptions
±–±-----+
| id | text |
±–±-----+
| 1 | text-1 |
| 2 | text-2 |
±–±-----+

datafeed
±—±------+
| pid | text |
±—±------+
| p25 | text-1 |
| p26 | text-2 |
±—±------+

I need to pass (text) value from datafeed table to descriptions table (text) column through books table WHERE books.id=descriptions.id


UPDATE `descriptions` 
SET `text` = (SELECT `text` from `datafeed` WHERE `datafeed`.`pid` = `books`.`pid` AND `books`.`id` = `descriptions`.`id`) 
WHERE EXISTS (SELECT 1 from `datafeed` WHERE `datafeed`.`pid` = `books`.`pid` AND `books`.`id` = `descriptions`.`id`);

I’m trying to write SQL query, but struggle with it. Please check what’s wrong with the above query.

I appreciate any of your help.

Appeciate you so much :slight_smile:

UPDATE descriptions 
INNER
  JOIN books
    on books.id = descriptions.id
INNER
  JOIN datafeed
    ON datafeed.pid = books.pid
   SET descriptions.text = datafeed.text