본문 바로가기

IT/코딩테스트

[Leetcode] 1141. User Activity for the Past 30 Days I

728x90

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
WHERE 
  activity_date BETWEEN DATE_ADD('2019-07-27', INTERVAL -29 DAY) AND '2019-07-27'
GROUP BY day;

 

728x90