Which of my posts have been downvoted?

0

Please login or register to vote for this query.

(click on this box to dismiss)

Lets you see where you went wrong.

Game Development Meta

Q&A about the site for professional and independent game developers

-- Which of my posts have been downvoted?
-- Lets you see where you went wrong.

DECLARE @UserId int = ##UserId##

SELECT p.Id as [Post Link],
       (SELECT COUNT(1)
        FROM Votes v
        JOIN VoteTypes t ON v.VoteTypeId = t.Id
        WHERE v.PostId = p.Id
        AND t.Name = 'UpMod') as Upvotes,
       (SELECT COUNT(1)
        FROM Votes v
        JOIN VoteTypes t ON v.VoteTypeId = t.Id
        WHERE v.PostId = p.Id
        AND t.Name = 'DownMod') as Downvotes
FROM Posts p
WHERE p.OwnerUserId = @UserId
ORDER BY Downvotes DESC, Upvotes DESC

Enter Parameters

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