I am trying to get the count value of two tables and use the member id as key to count the rows of the other tables, I have this code so far but it is outputting a big value for comCount and empty value for chatCount. Here is my code
SELECT members.*
, comments.commenter_id
, cb.user_id
, COUNT(comments.comment) AS comCount
, COUNT(cb.message) AS chatCount
FROM members
INNER JOIN comments ON members.id = comments.commenter_id
INNER JOIN chat_box AS cb ON members.id = cb.user_id
WHERE members.id ='$profileId'`