Questions in and out the Close Votes Review Queue (sample from 9-11, 2012)

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for programmers

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 >= '2012-11-01' 
            AND p.CreationDate < '2012-12-31'
		GROUP BY p.Id
	) qIn
	ON qIn.FirstCloseVoteDate = CONVERT(Date, Questions.ClosedDate)
WHERE Questions.CreationDate >= '2012-11-01' 
    AND Questions.CreationDate < '2012-12-31'
    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
:records returned in :time ms:cached