Proportion of anonymous v.s. effective votes on questions and answers.

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

SELECT
CASE WHEN qora.t = 1 THEN 'Q' ELSE 'A' END as 'type',
CASE WHEN uord.t = 2 THEN 'up' ELSE 'down' END as 'vote',
COUNT(p.Id) as 'num posts',
COUNT(v.Id) as 'effective',
COUNT(f.Id) as 'anonymous'
FROM
(VALUES (1), (2)) as qora(t)
CROSS JOIN (VALUES (2), (3)) as uord(t)
INNER JOIN Posts as p on p.PostTypeId = qora.t
LEFT OUTER JOIN Votes as v ON (p.Id = v.PostId AND v.VoteTypeId = uord.t)
LEFT OUTER JOIN PostFeedback as f ON (p.ID = f.PostId AND f.VoteTypeId = uord.t)
-- minid: minimum post ID to consider
WHERE p.Id >= ##minid:int##
GROUP BY qora.t, uord.t
ORDER BY qora.t, uord.t ASC

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results