Using Stack Exchange Data Explorer, how can you find the answers to a particular question?

I would assume it would be something like this:

SELECT answers FROM (
    SELECT id=12345 FROM posts

However, there is no answers parameter in the schema.
How can I do this?

migrated from stackapps.com Apr 26 '16 at 1:21

This question came from our site for apps, scripts, and development with the Stack Exchange API.

  • 1
    @BrockAdams omg syntax highlighting – OldBunny2800 Apr 26 '16 at 0:21

See Database schema documentation for the public data dump and SEDE.

Both questions and answers are in the Posts table.

  • Questions have a PostTypeId of 1
  • Answers have a PostTypeId of 2
  • If a post record is an answer, it will have a non-null ParentId that equals the Posts.Id of the parent question.

So, to get the answers to question number 2677, you would use SQL like:

FROM    Posts a
WHERE   a.ParentId = 2677

For a more practical example, see this SEDE query:
        Anonymous Feedback for a specific question and its answers

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .