I am not sure what I am missing but I know it should not be this hard. I have two tables. First table lists all the possible jobs for a site. The second table has when a job was completed at a site. I want a query where by I get all the possible jobs and join in the data from the seconds table should there be some. Site that have not completed the job would have a NULL value.
Example:
Table 1:
ID
name
decsription
Table 2:
ID
siteID
status
jobID
SELECT table1.* , table2.*
FROM table1
LEFT JOIN table2
ON table1.id = table2.jobID
WHERE siteID = 12
This only returns jobs that have been completed and not all jobs completed and uncompleted.
Thanks in advance for your help.
you should drop then where statement (when the row in second table is emty it doesn’t meet the condition siteID=12) or change it (add “OR siteID is NULL” ) if you want this specific site or null