SELECT to_char(month, 'MM/YYYY') as monthyear, count(DISTINCT username)as "active users"
FROM users_stats_monthly
WHERE dataset='tigge-lam' AND month>=date'20130101'
AND username IN (
SELECT username
FROM users_stats_monthly
WHERE dataset='tigge-lam'
GROUP BY username
HAVING sum(requests) >= 3
)
GROUP BY month
ORDER BY month; |