Users with the lowest upvote/downvote ratio
Q&A for linguists, teachers, and students wanting to discuss the finer points of the Latin language
SELECT top (##TopX?100##) row_number() over (order by convert(float, UpVotes)/(DownVotes+0.0000001), DownVotes desc, UpVotes asc, DisplayName, CreationDate) as Rank, Id AS [User Link], 1.0*UpVotes/nullif(DownVotes,0) as [Up/down ratio], 1.0*DownVotes/nullif(UpVotes,0) as [Down/up ratio], UpVotes, DownVotes, (UpVotes+DownVotes) as TotalVotes INTO #Downvoters FROM Users WHERE DownVotes >= ##MinDownvotes?5## and (DownVotes+UpVotes) >= ##MinVoteTotal?100## and Id > -1 SELECT Rank, [User Link], round([Up/down ratio],3) as [Up/down ratio], round([Down/up ratio],3) as [Down/up ratio], UpVotes, DownVotes, TotalVotes FROM #Downvoters ORDER BY Rank SELECT Rank, case when [Down/up ratio] > ##RatioCap?200## then ##RatioCap## else [Down/up ratio] end as [Down/up ratio, capped at ##RatioCap##] FROM #Downvoters ORDER BY Rank