Reputation: 1229
A simple MySQL query is returning a result set that is missing results.
SELECT users.uid, users.firstname, users.lastname, jobs_apps.read_app, jobs_apps.datetime
FROM jobs_apps
JOIN users ON users.uid = jobs_apps.uid
WHERE jobs_apps.job_id = '90'
This returns a 29 rows. If I run the following:
SELECT * FROM jobs_apps WHERE job_id = '90'
I get 31 rows.
The 2 missing results have a value of 0 in the 'read_app' instead of 1.
What could be causing this?
P.S.: I tried running the original query and changing the SELECT clause to simply "SELECT * " and I still only get 29 out of the 31 rows back.
Upvotes: 0
Views: 79
Reputation: 908
Try an OUTER JOIN
in your query
ie;
SELECT users.uid, users.firstname, users.lastname, jobs_apps.read_app, jobs_apps.datetime
FROM jobs_apps
RIGHT OUTER JOIN users ON users.uid = jobs_apps.uid
WHERE jobs_apps.job_id = '90'
Hope this helps :-)
Upvotes: 1