Downvoted post data for a user

0

Please login or register to vote for this query.

(click on this box to dismiss)

スタック・オーバーフローMeta

プログラマーと熱狂的なプログラマーのためのサイトに関する質問と回答

declare @user_id int = ##UserId:int##
;

WITH DownvotedPosts AS (
    SELECT
        p.Id as [Post Link],
        p.Score,
        sum(case when p.Id = v.PostId then 1 else 0 end) as [Downvotes]
    FROM
        Posts p
    inner join
        Votes v on p.Id = v.PostId
    WHERE
        p.OwnerUserId = @user_id
    -- and v.VoteTypeId=3
    and p.Title like '%java%'
    GROUP BY
        p.Id, p.Score
)

SELECT
    *
FROM DownvotedPosts
-- ORDER BY Downvotes DESC, Score DESC

Enter Parameters

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