Fork of
Social network of editors on cswiki
by Jan Spousta
This query is marked as a draft
This query has been published
by Utar.
SQL
AخA
USE cswiki_p;
SELECT log.log_title as gets_thx, log.log_user_text as gives_thx, COUNT(*) as cnt
FROM logging as log,
(
SELECT log_title as user, COUNT(*) as cnt_gets
FROM logging
WHERE log_type="thanks"
AND log_timestamp > DATE_ADD(NOW(), INTERVAL -3 MONTH);
GROUP BY log_title
) as gets, /*those who were thanked by someone*/
(
SELECT log_user_text as user, COUNT(*) as cnt_gives
FROM logging
WHERE log_type="thanks"
AND log_timestamp > DATE_ADD(NOW(), INTERVAL -3 MONTH);
GROUP BY log_user_text
) as gives /*those who thanked to someone*/
WHERE log.log_type="thanks"
AND log_timestamp > DATE_ADD(NOW(), INTERVAL -3 MONTH)
AND gets.cnt_gets > 10 AND gets.cnt_gets + gives.cnt_gives > 20
AND gives.user = log.log_user_text AND gets.user = log.log_title
GROUP BY log_title, log_user_text
ORDER BY COUNT(*) DESC
LIMIT 10000;
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.