[문제]
[MySQL]
SELECT u.user_id AS buyer_id
, u.join_date
, SUM(CASE WHEN order_date BETWEEN '2019-01-01' AND '2019-12-31'
THEN 1
ELSE 0
END) AS orders_in_2019
FROM Users AS u
LEFT JOIN Orders AS o ON u.user_id = o.buyer_id
GROUP BY u.user_id
'SQL > LeetCode' 카테고리의 다른 글
| [LeetCode] 1174. Immediate Food Delivery II (0) | 2025.02.19 |
|---|---|
| [LeetCode] 1164. Product Price at a Given Date (0) | 2025.02.19 |
| [LeetCode] 1148. Article Views I (0) | 2025.02.19 |
| [LeetCode] 1141. User Activity for the Past 30 Days I (0) | 2025.02.19 |
| [LeetCode] 1084. Sales Analysis III (0) | 2025.02.19 |
