Hello, ive been searching for a sulution to this but havent seen one anywhere.
I want to display a news post, and next to it, the number of comments it has
I have two tables, one for news post (news) and another for news comments(news_comments).
the only problem is that if the news post does not have news comments, I STILL want to display it on the page
The problem is that if the count(*) is equal to zero, the row is not returned
SELECT COUNT(nc.newsID) AS num_comments, n.newsID, n.newsDATE, n.newsTITLE, n.newsARTICLE, n.newsPOSTEDBY
FROM news_comments AS nc INNER JOIN
news AS n ON nc.newsID = n.newsID
GROUP BY n.newsID, n.newsDATE, n.newsTITLE, n.newsARTICLE, n.newsPOSTEDBY
HAVING(COUNT(*) >=0)
is there any way to display the record even if the count = 0
any help would be appreciated thanks
I want to display a news post, and next to it, the number of comments it has
I have two tables, one for news post (news) and another for news comments(news_comments).
the only problem is that if the news post does not have news comments, I STILL want to display it on the page
The problem is that if the count(*) is equal to zero, the row is not returned
SELECT COUNT(nc.newsID) AS num_comments, n.newsID, n.newsDATE, n.newsTITLE, n.newsARTICLE, n.newsPOSTEDBY
FROM news_comments AS nc INNER JOIN
news AS n ON nc.newsID = n.newsID
GROUP BY n.newsID, n.newsDATE, n.newsTITLE, n.newsARTICLE, n.newsPOSTEDBY
HAVING(COUNT(*) >=0)
is there any way to display the record even if the count = 0
any help would be appreciated thanks