I have been looking at other solutions on here for this but they seem to specify on normal queries and not joins, unless I'm missing something.
I have the following mysqli query in a function (it loads a job and all the details that go with it)
$sql = "
SELECT j.*
     , p.*
     , i.*
     , s.*
     , t.* 
  FROM jobs j
  JOIN job_priority p
    ON p.priority_id = j.priority_id 
  JOIN it_staff i
    ON i.staff_id = j.assigned_to  
  JOIN job_status s
    ON s.status_id = j.status_id 
  JOIN tasks t
    ON t.job_id = j.job_id 
 WHERE j.job_id = '$job_id'
";
Now this query works fine but only if there is a value in the tasks table assigned to the corresponding job_id, but if there isnt any tasks assigned to the job then the result will come up blank. I understand WHY this is the case but what I want to do is select all the data and return it even if there are no tasks.
I have looked at IS NOT NULL and a few other solutions but I'm not sure on the correct syntax for it when using a join query like above.
So I am seeking the syntax to only select the tasks if they exist (the tasks and jobs table are linked/joined by the job_id column).
 
    