Anton.Sandbox

0

Please login or register to vote for this query.

(click on this box to dismiss)

Portuguese Language

Q&A for linguists, teachers and learners wanting to discuss the finer points of the Portuguese language

/* Upvotes by post place
*/

;WITH QuestionsSample AS
(
  SELECT q.Id
  FROM Posts q tablesample(.01 percent)
  WHERE PostTypeId = 1
  )
SELECT q.Id as QuestionId, a.Id as AnswerId, v.VoteTypeId, COUNT(*) as n, q.Id as [Post Link]
FROM Posts a
  RIGHT OUTER JOIN QuestionsSample q on q.Id = a.ParentId
  RIGHT OUTER JOIN Votes v ON v.PostId = a.Id
WHERE v.Id > 0 AND a.Id > 0 AND q.Id > 0 AND (v.VoteTypeId = 2 OR v.VoteTypeId = 3)
GROUP BY q.Id, a.Id, v.VoteTypeId
ORDER BY q.Id, a.Id, v.VoteTypeId

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results