How many comments do I have for each score.
Q&A for professional and enthusiast programmers
--DECLARE @Id int = ##QuestionId## /*SELECT p.Id, p.title, p.AcceptedAnswerId, p.Body, p.PostTypeId, p.OwnerUserId, p.OwnerDisplayName, p.AnswerCount, p.CommentCount, c.Text, c.UserId, c.UserDisplayName*/ -- get one question 56786655 /* SELECT * FROM Posts p --Comments c --JOIN Comments c ON p.Id = c.PostId WHERE P.Id = 56786655 */ -- get all comments of question 56786655 SELECT p.Body, c.Text, c.UserId FROM Posts p JOIN Comments c ON p.Id = c.PostId WHERE P.id = 56786655 -- get all answers of question 56786655 -- get all the comments of each answer