Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

MySQL Multiple Left Joins in one Query

by
Category:mysql
php mysql
MySQL Multiple Left Joins in one Query

The SQL LEFT JOIN (specified with the keywords LEFT JOIN and ON) joins two table or more tables and fetches all matching rows of two table or more tables for which the SQL-expression is true, plus rows from the frist table that do not match any row in the second table. You may also like Join Query in Laravel 5 and Join Query in Codeigniter.

First you can need database connection in php

Code

$sql = "SELECT wo_jobs.* FROM wo_jobs LEFT JOIN wo_clients ON wo_clients.id = wo_jobs.client_id LEFT JOIN wo_sectors ON wo_sectors.id = wo_jobs.sector_id WHERE wo_jobs.jobcode = '154' "; 
$result = mysqli_query($con,$sql);

0 Comments


Html code work in comment box


Related Post