Answer score by post length


Please login or register to vote for this query.

(click on this box to dismiss)

Groups posts of varying length together by answer score for a given user.

Stack Overflow

Q&A for professional and enthusiast programmers

DECLARE @UserId int = ##UserId##

p.Score as AnswerScore,
sum(case when len(p.body) <= 200 then 1 else 0 end) as PostsWithLen_0_200,
sum(case when len(p.body) between 201 and 500 then 1 else 0 end) as PostsWithLen_201_500,
sum(case when len(p.body) between 501 and 1000 then 1 else 0 end) as PostsWithLen_501_1000,
sum(case when len(p.body) between 1001 and 2000 then 1 else 0 end) as PostsWithLen_1001_2000,
sum(case when len(p.body) > 2001 then 1 else 0 end) as PostsWithLen_2001plus
    Posts p
    p.OwnerUserId = @UserId
    p.PostTypeId = 2
group by p.Score

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results