flynny
asked on
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;
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;
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Select article.title, article.text, article.picture, (select count(*) from comment where articleid = article.id ) as commentcount FROM article;