I’m trying to update a table but I need to do a left join to determine which rows I want to select.
These are two examples of what I’ve been trying, I think it’s clear what I want to do by seeing any of them:
UPDATE `User_Likes`
SET `Status` = 'read'
LEFT JOIN Posts ON User_Likes.PID = Posts.ID
WHERE Posts.UID = '1'
Here I’m trying another way:
UPDATE `User_Likes`
SET `Status` = 'read'
WHERE `ID` IN (SELECT Posts.ID
FROM `User_Likes`
LEFT JOIN Posts ON User_Likes.PID = Posts.ID
WHERE Posts.UID = '$userID')
Have a look at this Example
SQL Fiddle DEMO