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
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.
Some RDMS give additional options like using CTEs or Cross Apply