MySQL Forums
Forum List  »  Newbie

Re: SQL Update Table Based on Join and Multiple Where Clauses
Posted by: Phillip Ward
Date: December 09, 2021 03:43AM

MySQL's "update from multiple tables" syntax goes like this:

UPDATE table1 t1
INNER JOIN table2 t2 ON t1.? = t2.? ... 
SET table1.value = ... 
WHERE ...

So, in your case, I think it should be something like:

UPDATE tbl_appointment a
LEFT JOIN join tbl_client c 
       ON c.id = a.client_id
SET a.active_app = 0
WHERE c.mfl_code = '10808'
  AND a.app_status = 'LTFU'
  AND a.active_app = 1 ;

Regards, Phill W.

Options: ReplyQuote


Subject
Written By
Posted
Re: SQL Update Table Based on Join and Multiple Where Clauses
December 09, 2021 03:43AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.