SQL
x
#SELECT patrollers.user_id #, COUNT(log_action)
#FROM (
#SELECT user_id FROM user JOIN user_groups ON user_id = ug_user WHERE ug_group = 'patroller'
#UNION
SELECT user_id, COUNT (log_action)
FROM user_groups JOIN user ON user_id = ug_user
LEFT JOIN logging ON user_id = log_user
WHERE ug_group = 'patroller'
AND log_action = 'reviewed' OR log_action is NULL
AND log_timestamp > (NOW() - INTERVAL 1 DAY);
#) AS patrollers
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.