Fork of Most thanking/thanked users (total, last year) on skwiki by Teslaton
This query is marked as a draft This query has been published by Geraki.

SQL

x
 
USE elwiki_p;
-- Most thanked, total
SELECT
    log_title as thanked, COUNT(*) as count
  FROM
    logging
  WHERE
    log_type = "thanks"
  GROUP BY
    log_title
  ORDER BY
    count DESC, log_title
  LIMIT
    100;
    
-- Most thanking, total
SELECT
    log_user_text as thanking, COUNT(*) as count
  FROM
    logging
  WHERE
    log_type = "thanks"
  GROUP BY
    log_user_text
  ORDER BY
    count DESC, log_user_text
  LIMIT
    100;    
-- Most thanked, last 12 months
SELECT
    log_title as thanked_last_year, COUNT(*) as count
  FROM
    logging
  WHERE
    log_type = "thanks" and
    log_timestamp > DATE_SUB(NOW(), INTERVAL 1 YEAR)
  GROUP BY
    log_title
  ORDER BY
    count DESC, log_title
  LIMIT
    100;
    
-- Most thanking, last 12 months
SELECT
    log_user_text as thanking_last_year, COUNT(*) as count
  FROM
    logging
  WHERE
    log_type = "thanks" and
    log_timestamp > DATE_SUB(NOW(), INTERVAL 1 YEAR)
  GROUP BY
    log_user_text
  ORDER BY
    count DESC, log_user_text
  LIMIT
    100;    
By running queries you agree to the Cloud Services Terms of Use and you irrevocably agree to release your SQL under CC0 License.
All SQL code is licensed under CC0 License.

Checking query status...