Jump to content

mySQL select COUNT & display problem


nyxtyr

Recommended Posts

my problem is that my code only displays my posts that have comments, and i want it to display all news posts and to show how many comments they each have, i think i may have to pull two queries to do this, but not sure how or even if i would have to

[code]SELECT COUNT(article_comment.article_id), article.article_title, article.article_content, article.article_submitted, user.user_name, user.user_email
FROM article_comment, article, user
WHERE article_comment.article_id = article.article_id
AND article.user_id = user.user_id
GROUP BY article_comment.article_id
ORDER BY article.article_submitted ASC
[/code]

posted this on
[a href=\"http://www.phpfreaks.com\" target=\"_blank\"]http://www.phpfreaks.com[/a] : [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=89608\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=89608[/a]
[a href=\"http://www.neverside.com\" target=\"_blank\"]http://www.neverside.com[/a] : [a href=\"http://forums.neverside.com/thread/92438/\" target=\"_blank\"]http://forums.neverside.com/thread/92438/[/a]
[a href=\"http://www.mysqlfreaks.com\" target=\"_blank\"]http://www.mysqlfreaks.com[/a] : [a href=\"http://www.mysqlfreaks.com/forums/index.php?showtopic=9155\" target=\"_blank\"]http://www.mysqlfreaks.com/forums/index.php?showtopic=9155[/a]
[a href=\"http://www.sitepoint.com\" target=\"_blank\"]http://www.sitepoint.com[/a] : [a href=\"http://www.sitepoint.com/forums/showthread.php?t=363607\" target=\"_blank\"]http://www.sitepoint.com/forums/showthread.php?t=363607[/a]


problem solved here [a href=\"http://www.sitepoint.com/forums/showpost.php?p=2616828&postcount=2\" target=\"_blank\"]http://www.sitepoint.com/forums/showpost.p...828&postcount=2[/a]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.