Hi,
Am using the folling query to give me a list of jobs, the number of applications for those jobs and the number of times the advert has been viewed.
Code:
SELECT jobs.job_id
, jobs.job_title
, COUNT(apps.app_id) AS applicantions
, COUNT(log.job_view_id) AS job_views
FROM tbl_jobs AS jobs
LEFT JOIN tbl_applications AS apps ON jobs.job_id = apps.job_id
LEFT JOIN tbl_job_view_log AS log ON jobs.job_id = log.job_id
GROUP BY jobs.job_id
However I am getting incorrect results. If there is 1 application and the advert has been viewed twice am getting a count of 2 for applications as well.
Can some one point me in the right direction.
Cheers.