Questions in and out the Close Votes Review Queue

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

DECLARE @From datetime = ##DateFrom##
DECLARE @To datetime = ##DateTo##

SELECT
	CONVERT(Date, Questions.ClosedDate) AS Date,
	COUNT(DISTINCT qIn.Id) AS QuestionsIn,
	COUNT(DISTINCT Questions.Id) QuestionsOut
FROM Posts Questions
	INNER JOIN (
		SELECT
			p.Id,
			MIN(v.CreationDate) AS FirstCloseVoteDate
		FROM Posts p
			INNER JOIN Votes v
			ON V.PostId = p.Id
			AND v.VoteTypeId = 6 -- Close
		WHERE p.CreationDate >= @From
            AND p.CreationDate < @TO
		GROUP BY p.Id
	) qIn
	ON qIn.FirstCloseVoteDate = CONVERT(Date, Questions.ClosedDate)
WHERE Questions.CreationDate >= @From
    AND Questions.CreationDate < @TO
    AND Questions.ClosedDate IS NOT NULL
GROUP BY CONVERT(Date, Questions.ClosedDate)
ORDER BY CONVERT(Date, Questions.ClosedDate)

Enter Parameters

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