SQL
x
SET @yearsago20=DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -20 YEAR), '%Y%m%d%H%i%s');
SET @monthsago3=DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -3 MONTH), '%Y%m%d%H%i%s');
WITH old_users(ou_actor, ou_name) AS
(
SELECT DISTINCT actor_id, actor_name
FROM revision
JOIN actor_revision ON actor_id = rev_actor
WHERE rev_timestamp <= @yearsago20
)
SELECT ou_name
FROM old_users
WHERE EXISTS (SELECT 1
FROM revision_userindex
WHERE rev_actor = ou_actor
AND rev_timestamp >= @monthsago3);
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.