
문제
https://leetcode.com/problems/customer-who-visited-but-did-not-make-any-transactions/description/
문제 설명
- 쇼핑몰에 방문한 고객들 중 아무 거래도 하지 않고 방문만 한 경우를 찾아, 각 고객이 그런 방문을 몇 번 했는지 구하기
- 단, 한 번도 거래 없이 방문하지 않은 고객은 제외
정답 코드
SELECT v.customer_id,
COUNT(*) AS count_no_trans
FROM visits v LEFT JOIN transactions t ON v.visit_id = t.visit_id
WHERE t.transaction_id IS NULL
GROUP BY v.customer_id
'코딩 테스트 연습 > [프로그래머스][리트코드] MySQL' 카테고리의 다른 글
| 1661. Average Time of Process per Machine ⭐️ (3) | 2025.08.25 |
|---|---|
| 197. Rising Temperature ⭐️ (0) | 2025.08.21 |
| 1068. Product Sales Analysis I (1) | 2025.08.15 |
| 1378. Replace Employee ID With The Unique Identifier (1) | 2025.08.13 |
| 1683. Invalid Tweets (0) | 2025.08.11 |