LEFT JOIN and WHERE
I have the following query:
What I want to do is also show articles via a topic_id URL parameter.
SELECT a.article_id, a.title, a.text, a.picture, a.topic_id, date_format(a.pub_date,' %D %M %Y') as pub_date, COUNT(c.article_id) AS total
FROM articles a LEFT JOIN comments c ON a.article_id = c.article_id
GROUP BY a.article_id, a.title, a.text, a.topic_id, pub_date
So before it worked with this query:
The first query shows the article with the comments total, the second just shows the article via the topic_id.
WHERE topic_id = colname
I want to be able to show the article via the topic_id with the correct number of comments.
You might want to post this in the MySQL forum or ask a moderator to move it there for you. :)