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

-- SELECT TOP 100 
--   [Users].Id as [User Link], 
--   [Users].Reputation, 
--  DATEDIFF(year, [Users].CreationDate, GETDATE()) "UserAge"
-- FROM Users
-- WHERE [Users].Reputation > 1000
-- -- temporary sort; really sort by percent
-- ORDER BY [Users].Reputation DESC

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

-- CREATE TABLE #usernotaccepted (userid int, unaccepted int);
-- INSERT INTO #usernotaccepted (userid, unaccepted)
-- VALUES 
-- 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 
--   #useraccepted.userid as [User Link], 
--   #useraccepted.accepted, 
--   #usernotaccepted.unaccepted, 
--   (100 * accepted / (accepted + unaccepted)) as ratio
-- FROM #useraccepted 
-- JOIN #usernotaccepted
-- ON useraccepted.userid = usernotaccepted.userid
-- ORDER BY ratio DESC

Enter Parameters

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