Monday, August 15, 2022

Update Records Into Tables Using SQL Join Query

 this query is used for update record into tables with join and where query which update all matching records.

UPDATE `product`

inner join `category` on `category`.`id` = `product`.`category_id` and `category`.`deleted_at` IS NULL

 SET `product`.`category_id` = category.id WHERE `product`.`deleted_at` IS NULL AND `id` = '1'

No comments:

Post a Comment

Generate Even Numbers in a Range In PHP.

$start = 1; $end = 20; for ($i = $start; $i <= $end; $i++) {     if ($i % 2 == 0) {         echo $i . " is even.<br>";   ...