Q&A about the site for information security professionals
SELECT TOP(##num?500##) q.Id AS [Post Link], COUNT(a.Id) FROM PostsWithDeleted a INNER JOIN Votes v ON v.PostId = a.Id INNER JOIN Posts q ON a.ParentId=q.Id ---using Posts rather than PostsWithDeleted for questions ---This means that the query returns only the questions which aren't deleted WHERE v.VoteTypeId IN (##types?4,12##) GROUP BY q.Id ORDER BY COUNT(a.Id) DESC