users and their accepted question rate

1

Please login or register to vote for this query.

(click on this box to dismiss)

rep greater than 1,000? yes -- "established user - You've been around for a while"

Unix and Linux

Q&A for users of Linux, FreeBSD and other Un*x-like operating systems

CREATE TABLE #useraccepts (userid int, accepted int);

INSERT  #useraccepts (userid, accepted)
SELECT q.OwnerUserId, COUNT(q.Id)
FROM Posts q
WHERE 
q.PostTypeId = 1
AND q.AcceptedANswerId IS NOT NULL
AND q.ClosedDate IS NULL
GROUP BY q.OwnerUserId


CREATE TABLE #usernotaccepted (userid int, unaccepted int);
INSERT #usernotaccepted (userid, unaccepted)
SELECT q.OwnerUserId, COUNT(q.Id)
FROM Posts q
WHERE 
-- 1 = Question
q.PostTypeId = 1
-- Q has an accepted Answer
AND q.AcceptedANswerId IS NULL
-- Q is not closed
AND q.ClosedDate IS NULL
GROUP BY q.OwnerUserId

SELECT 
  #useraccepts.userid as [User Link], 
  accepted, 
  unaccepted, 
  (100 * accepted / (accepted + unaccepted)) as ratio,
  u.reputation,
  (1+datediff(dd, u.creationdate, GETDATE())) "Age in Days"
FROM #useraccepts
JOIN #usernotaccepted
ON #useraccepts.userid = #usernotaccepted.userid
JOIN Users u
ON #useraccepts.userid = u.id
WHERE u.reputation > 1000
ORDER BY unaccepted DESC

Enter Parameters

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