[LeetCode] 511. Game Play Analysis I
2022. 11. 27. 15:47ㆍTIL💡/Database
https://leetcode.com/problems/game-play-analysis-i/
GROUP BY를 활용하면 간단한 문제인데, 셀프조인으로 빙빙 돌려서 조건문 처리할 생각을 하던 나 자신.. 반성해..!
Intuition
Group rows into subgroups specific to each player with GROUP BY and then extract the minimum date value from each group with MIN()
SELECT player_id, MIN(event_date) AS first_login
FROM Activity
GROUP BY player_id;
'TIL💡 > Database' 카테고리의 다른 글
[LeetCode] 550. Game Play Analysis IV (0) | 2022.12.07 |
---|---|
[LeetCode] 534. Game Play Analysis III (0) | 2022.11.27 |
[LeetCode] 181. Employees Earning More Than Their Managers (0) | 2022.11.27 |
[LeetCode] 177. Nth Highest Salary (0) | 2022.11.27 |
[MySQL] 196. Delete Duplicate Emails (0) | 2022.11.27 |