Jump to content

User:SQL/AIVAStats

From Wikipedia, the free encyclopedia

Code

[edit]
USE s53613__aiv; 
SELECT reporter, 
       blocked, 
       notblocked, 
       total, 
       Round(Sum(blocked / total) * 100, 2) AS pct 
FROM   (SELECT reporter, 
               Sum(IF(result = "blocked", 1, 0))    AS blocked, 
               Sum(IF(result = "notblocked", 1, 0)) AS "notblocked", 
               Count(*)                             AS total 
        FROM   reports AS r 
        GROUP  BY reporter 
        ORDER  BY blocked DESC) AS d 
WHERE  total > 5 
GROUP  BY reporter 
ORDER  BY pct DESC;

Data

[edit]