This query is marked as a draft This query has been published by لوقا.

SQL

x
 
/*
select
  actor_name as name,
  COUNT(*) as score
from
  logging
  INNER JOIN actor ON log_actor = actor.actor_id
where
  #and ucase(actor_name) not like ucase("%BOT") COLLATE utf8_general_ci
  #and actor_name not like "%بوت%" collate utf8_general_ci
  #and actor_name Not IN (SELECT user_name
   #                      FROM user_groups
    #                              INNER JOIN user ON user_id = ug_user
     #                    WHERE ug_group = "bot")
  #and
  #log_action = "patrol"
  log_action = "approve-i"
  #and log_namespace = 0
group by actor_name
having COUNT(*) > 1
ORDER BY score DESC,name
LIMIT 10;
*/
/*
select distinct(log_action) from logging 
where log_type = "review"
*/
SELECT
  actor_name AS name,
  SUM(CASE WHEN log_action = 'approve' THEN 1 ELSE 0 END) AS approve,
  SUM(CASE WHEN log_action = 'approve-a' THEN 1 ELSE 0 END) AS 'approve-a',
  SUM(CASE WHEN log_action = 'approve-i' THEN 1 ELSE 0 END) AS 'approve-i',
  SUM(CASE WHEN log_action = 'approve-ia' THEN 1 ELSE 0 END) AS 'approve-ia',
  SUM(CASE WHEN log_action = 'approve2' THEN 1 ELSE 0 END) AS 'approve2',
  SUM(CASE WHEN log_action = 'approve2-i' THEN 1 ELSE 0 END) AS 'approve2-i',
  SUM(CASE WHEN log_action = 'unapprove' THEN 1 ELSE 0 END) AS 'unapprove',
  SUM(CASE WHEN log_action = 'unapprove2' THEN 1 ELSE 0 END) AS 'unapprove2'
  SUM(CASE WHEN log_action in ('approve-i') THEN 1 ELSE 0 END) AS 'total'
FROM logging
INNER JOIN actor ON log_actor = actor.actor_id
and log_type = "review"
and actor_name in ("Sami Lab")
GROUP BY actor_name
ORDER BY name ASC
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...