A day accounted for "How Unsung Am I?"

1

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- A more accurate How Unsung am I?
-- Accounts for answers that are only 10 days or older

SELECT
    COUNT(answer.Id) as [Accepted Answers],
    SUM(CASE WHEN answer.Score = 0 THEN 0 ELSE 1 END) AS [Scored Answers],  
    SUM(CASE WHEN answer.Score = 0 THEN 1 ELSE 0 END) AS [Unscored Answers],
    SUM(CASE WHEN answer.Score = 0 THEN 1 ELSE 0 END)*1000 / COUNT(answer.Id) / 10.0 AS [Percentage Unscored]
FROM
    Posts question
    INNER JOIN
        Posts answer
    ON 
        answer.Id = question.AcceptedAnswerId
WHERE
    answer.CommunityOwnedDate is NULL
    AND answer.OwnerUserId = ##UserId##
    AND question.OwnerUserId != ##UserId##
    AND answer.postTypeId = 2
    AND answer.CreationDate < DATEADD(day, -10, GETDATE())

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results