SELECT qUserId , aUserId , SUM( aWeight ) AS N FROM ( SE...

0

Please login or register to vote for this query.

(click on this box to dismiss)

English

Q&A for linguists, etymologists, and serious English language enthusiasts

SELECT
	qUserId
,	aUserId
,	SUM( aWeight ) AS N

FROM (
	SELECT
		q.Id 										AS qId
	,	q.OwnerUserId 								AS qUserId
	, 	q.CreationDate 								AS qDate
	, 	q.AcceptedAnswerId 							AS aId
	,	a.OwnerUserId 								AS aUserId
	,	( a.CreationDate - q.CreationDate )			AS aDelay
	,	1 / COUNT( q.AcceptedAnswerId ) OVER( PARTITION BY q.Id )	AS aWeight

	FROM
		Posts AS q
	
	INNER JOIN
		Posts AS a
	ON	a.Id = q.AcceptedAnswerId
	
	WHERE
		q.CreationDate BETWEEN '2012-12-01 00:00:00' AND '2012-12-31 23:59:59'
) AS t

GROUP BY
	qUserId
,	aUserId

Enter Parameters

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