Thursday, November 22, 2018

How to update multiple table in MySQL?

Update multiple table with join in MYSQL


<?php
     $sql = "UPDATE table1
                 JOIN table2 VCR ON  (table1.contact_id = table2.contact_id)
                SET table1.email_status = 1,
                table2.review_status = 1
                WHERE table2.contact_id = 1005";
  ?>



Update single fields with join in MYSQL

<?php
   
$sql = "UPDATE table1 INNER JOIN table2 ON  table1.contactid = table2.contactid SET               table1.statue =1 WHERE  table2.crm_customer_id = 1004";

?>

0 comments:

Post a Comment