Please help me write a mysql query -


i need find news items news table , number of comments each news item comments table. need in single array/resultset... tables linked news.id=news_comments.news_id. help?

how like

select  news.id,         count(comments.news_id) totalcomments    news left join         comments    on  news.id=news_comments.news_id group    news.id 

if use left join, result set return news articles no comments, if use inner join, these articles excluded result set.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -