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


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

Leave a Reply

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