7

I've been interested in what sort of questions are helpful to anonymous people rather than regulars. I would like to get a count of anonymous feedback "Helpful" and "Not Helpful" votes on a question.

I cannot see how that information is available through the schema.

I am not sure if I am simply missing something staring at me in the face, or whether the Stack Exchange team have decided it isn't worth sharing this information. (Or another alternative I haven't considered!)

How do you fetch a count of anonymous feedback helpful votes on a post through the Stack Exchange Data Explorer?

1 Answer 1

8

It's in the PostFeedback table, where an up vote (VoteTypeId = 2) corresponds to helpful, and a down vote (VoteTypeId = 3) is not helpful.

So for a given post ##PostId##, the query becomes something like

SELECT COUNT(CASE WHEN VoteTypeId = 2 THEN 1 END) AS HelpfulVotes,
       COUNT(CASE WHEN VoteTypeId = 3 THEN 1 END) AS NotHelpfulVotes
FROM PostFeedback
WHERE PostId = ##PostId##
GROUP BY PostId

You may want to add a where clause in there to filter on IsAnonymous too, depending on whether you care to exclude registered users who can't vote or not from the totals.

1
  • Ah, according to the VoteType table, these are "UpMod" and "DownMod" votes. The bit that I failed to comprehend while looking was that they have nothing to do with Moderators. Thanks. Commented Jun 30, 2014 at 7:23

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.