Sim Posted January 24, 2021 Share Posted January 24, 2021 SELECT COUNT(JR_refID) AS rankCount, J_id AS id, J_name AS name, J_desc AS `desc` FROM jobs JOIN jobRanks ON(J_id =JR_refID) GROUP BY J_id ORDER BY J_id ASC My problem is if theres a job with no Ranks, it is not included in in the results. What am I missing? Thanks in advance!! I know @Magictallguy got an answer here. Quote Link to comment Share on other sites More sharing options...
AdamHull Posted January 24, 2021 Share Posted January 24, 2021 (edited) You need to use LEFT JOIN then this should solve your issue SELECT COUNT(JR_refID) AS rankCount, J_id AS id, J_name AS name, J_desc AS `desc` FROM jobs LEFT JOIN jobRanks ON( J_id =JR_refID ) GROUP BY J_id ORDER BY J_id ASC Edited January 24, 2021 by AdamHull 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.