Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6810853
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:15:22+00:00 2026-05-26T20:15:22+00:00

Setup as below works. But, what I want to achive is to count how

  • 0

Setup as below works.
But, what I want to achive is to count how many rows there is in BlogComment where BlogComment.BlogPostId = BlogPost.BlogPostId.

Anyone got suggestion ?

SELECT * FROM BlogPost
INNER JOIN BlogUser
ON BlogPost.BlogUserId = BlogUser.BlogUserId
INNER JOIN Category
ON BlogPost.CategoryId = Category.CategoryId
INNER JOIN BlogComment
ON BlogPost.BlogPostId = BlogComment.BlogPostId
Order By BlogPost.BlogPostId Desc
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:15:23+00:00Added an answer on May 26, 2026 at 8:15 pm

    If you want all the data plus a count (as opposed to just the count) you can create an inline query in the from clause to do this.

    SELECT *, 
           COALESCE(c.count_post_id,0) as count_post_id
    FROM   blogpost 
           INNER JOIN bloguser 
             ON blogpost.bloguserid = bloguser.bloguserid 
           INNER JOIN category 
             ON blogpost.categoryid = category.categoryid 
           LEFT JOIN (SELECT blogpostid, 
                              COUNT(blogpostid) count_post_id
                       FROM   blogcomment
                       GROUP BY blogpostid) c
             ON c.blogpostid = blogpost.blogpostid 
    ORDER  BY blogpost.blogpostid DESC 
    

    Some RDMS give additional options like using CTEs or Cross Apply

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got the idea of how I want my graphics to look but I've
I have the code below which works fine, steps through the rows pinging each
Given the below setup and code snippets, what reasons can you come up with
My setup as below # export PATH=/usr/sbin:/usr/bin:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin # ./configure --prefix=/usr/local/nginx --user=webservd --group=webservd --with-http_stub_status_module --with-openssl=/usr/local/ssl/bin/openssl
while running: rake snorby:setup getting below error: rake aborted! You have already activated rake
I have a HTML document with the below setup: <div class=main-div style=padding: 5px; border:
I setup a logging.xml file as shown below. This file includes output to the
I have setup background image for a button as below. // declarations globally declared...
In the code snippet below, from my jQuery setup, I need to check if
I have a standard list view setup with backbone that looks something like below.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.