Hi! I'm quite a beginner at this so please forgive me if this seems a bit easy for some of you.
So, I have this query here:
SELECT code.id AS codeid, code.title AS codetitle, code.summary AS codesummary, code.author AS codeauthor, code.rating AS rating, code.date,
code_tags.*,
tags.*,
users.firstname AS authorname,
users.id AS authorid,
GROUP_CONCAT(tags.tag SEPARATOR ', ') AS taggroup
FROM code, code_tags, tags, users
WHERE users.id = code.author AND code_tags.code_id = code.id AND tags.id = code_tags.tag_id
GROUP BY code_id
ORDER BY date DESC
Pretty intense. I want to count the number of comments a code
submission has from the table comments. I can't add it as a WHERE comments.codeid = code.id
because then that won't select submissions from the database without comments.
How can I add in something along the lines of LEFT JOIN comments.codeid ON code.id = comments.codeid
or something along those lines?
Thanks!
Jack