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
Code
$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.