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.

Vegetarianism

Q&A for those committed to a vegan or vegetarian lifestyle and anyone interested in learning more

-- 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 meta site
loading Hold tight while we fetch your results