I have three tables:
I need to join companies to jobs. I also need to join applications to jobs, but only if a job exists. The below sql works, but it returns a row even if there are no rows in the jobs table. How can I make it so that if there are no jobs then nothing is returned?
SELECT jobs. *, companies.company_name, count( applications.id ) AS applications
JOIN companies ON companies.id = jobs.company_id
INNER JOIN applications ON applications.job_id = jobs.id
ORDER BY jobs.date_posted DESC