WITH s (ID,sum,up,down) as( SELECT ID,UpVotes+DownVotes,...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Philosophy Meta

Q&A about the site for those interested in the study of the fundamental nature of knowledge, reality, and existence

WITH s (ID,sum,up,down) as(
SELECT  ID,UpVotes+DownVotes,UpVotes,DownVotes FROM USERS
WHERE UpVotes>0 and  DownVotes>0
GROUP BY ID,UpVotes+DownVotes,UpVotes,DownVotes
HAVING UpVotes>100 OR DownVotes>100
)
SELECT top 10 Users.ID, DisplayName, UpVotes,
DownVotes,UpVotes+DownVotes AS Sum
FROM Users
JOIN s on Users.ID=s.ID
WHERE  ROUND((UpVotes*10/(s.sum)-DownVotes*10/(s.sum)),1)=1 OR 
ROUND((UpVotes*10/(s.sum)-DownVotes*10/(s.sum)),1)=-1
GROUP BY  Users.ID,DisplayName, UpVotes, DownVotes

Enter Parameters

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