MySQL select with a count query on another table
I have simple article application with three tables: article id, title, body, user_id comment id, article_id, user_id, body user id, username On the landing page, I want to show the latest article titles with the author name and total numbers of comments of the article. The main problem is how to get total numbers of comments of the article,I did not get it right. I should get the following output: title username total_comments article 2 user2 0 article 1 user1 2 In my real application, I added a column in article table for total number of comments to the article. this column is updated when a