Left Join Query in Mysql

The SQL LEFT JOIN returns all records from the left table (jobs), and the matched records from the right table (clients). The result is NULL from the right side, if there is no match.

First you can need database connection in php


$sql = "SELECT jobs.* FROM jobs 
LEFT JOIN clients ON clients.id = jobs.client_id 
WHERE jobs.jobcode = '1' "; 
$result = mysqli_query($con, $sql);

Here is image to help you understand more about SQL join.

sql join script guru

Leave a Reply

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