Mysql UPDATE query using Join Statement

Here you can find how to use update query with join, difficult update query in join

We often use join clauses to query rows in a table that have (in the case of INNER JOIN) or may not have (in the case of LEFT JOIN) corresponding rows in another table. In MySQL, we can use the JOIN clauses in the UPDATE statement to perform the cross-table update.

First you can need database connection in php

Mysql UPDATE query Code

$querydelte = mysqli_query($con,"UPDATE `iosr_car_series` AS `cs` 
INNER JOIN `iosr_car_master` AS `cm` ON `cs`.`car_id` = `cm`.`car_id` 
INNER JOIN `iosr_car_model` AS `cmm` ON `cmm`.`model_id` = `cs`.`model_id` 
SET cm.status =1,cmm.status=1,cs.status = 1 
WHERE cs.series_id = '".$_GET['approve']."' "); 
    $message = 'Car Model Approved Successfully!!';
    $message = 'Due to some Error Please try again!!';

Leave a Reply

Your email address will not be published. Required fields are marked *