Leecode - 1141.User Activity for the Past 30 Days I
문제
https://leetcode.com/problems/user-activity-for-the-past-30-days-i/
정답
SELECT activity_date as day, COUNT(DISTINCT user_id) as active_users
FROM Activity
# BETWEEN is inclusive so subtract 29 days
WHERE activity_date BETWEEN DATE_SUB('2019-07-27', INTERVAL 29 DAY) AND '2019-07-27'
GROUP BY activity_date