select count and information from table mysql

Hi all

A quick (and hopefully easy) question.

We have two tables, one for storing atricles, and another for storing comments assciated  with the article.

Table Article
ID, picture, title, text

Table comment
ID, articleID, comment

Now I want to be able to select the following;

article.title, article.text, article.picture, Count(select row countof comments associated with article) FROM article;

flynnyAsked:
Who is Participating?
 
wuyinzhiConnect With a Mentor Commented:
maybe something like this:

select a.title, a.text, a.picture, (select count(id) from table_comment where id = a.id) as count from table_article a
0
 
Aaron TomoskySD-WAN SimplifiedCommented:
Select article.title, article.text, article.picture, (select count(*) from comment where articleid = article.id ) as commentcount FROM article;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.