top-answers-by-month

0

Please login or register to vote for this query.

(click on this box to dismiss)

EOS.IO

Q&A for users and developers of distributed applications built on top of the blockchain operating system, EOS.IO

DECLARE @Days INT = ##Days##;
-- Days: Past Days "Enter the number of past days to search"

SELECT TOP 50
    p.Id AS [Post Link],
    SUM(CASE WHEN v.VoteTypeId = 2 THEN 1 ELSE 0 END) AS [Upvotes],
    SUM(CASE WHEN v.VoteTypeId = 3 THEN 1 ELSE 0 END) AS [Downvotes],
    p.Score AS [answer score],
    p.CreationDate AS [Date Posted]
FROM Posts p
LEFT JOIN Votes v ON p.Id = v.PostId
WHERE
    p.PostTypeId = 2 AND
    DATEDIFF(day, p.CreationDate, GETDATE()) <= @Days
GROUP BY p.Id, p.Score, p.CreationDate
ORDER BY [answer score] DESC

Enter Parameters

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