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";

?>

Related Posts:

  • PHP Error Types - And their Differences Notices : It will be shown in below condition like if we will try to access a variable which is not defined yet. it will not stop script execution. Warning : It will be shown while using include(), it will not a… Read More
  • How can insert the data in mysql using php? step 1:- Firstly create a database name & secondly create a table in MySQL. step 2:-After that create a table structure eg. Column Name1 , Coulmn Name2 , Coulmn NameN... <?php mysql_connect("localhost","root"… Read More
  • OOP PHP Login Tutorial   What is a PHP Secure Login System with Registration? Many applications need to register and authenticate users. Some users have developed their own packages for this purpose, others have used existing p… Read More
  • PHP Case Sensitivity PHP Case Sensitivity In PHP, all keywords (e.g. if, else, while, echo, etc.), classes, functions, and user-defined functions are NOT case-sensitive. In the example below, all three echo statements below are legal (and … Read More
  • MySql Quaries You can create and populate the example table with these statements: CREATE TABLE shop ( article INT(4) UNSIGNED ZEROFILL DEFAULT '0000' NOT NULL, dealer CHAR(20) DEFAULT '' NOT NULL, p… Read More

0 comments:

Post a Comment