[LeetCode/SQL] 1581. Customer Who Visited but Did Not Make Any Transactions

Sooyeon·2023년 11월 14일
0

문제풀이 

목록 보기
50/95
post-thumbnail

[LeetCode/SQL]


📌 1581. Customer Who Visited but Did Not Make Any Transactions

문제

풀이

- cutomer_id,와 transaction이 없이 방문한 횟수를 구하라 

방법

SELECT v.customer_id
       ,COUNT(*) AS count_no_trans
FROM Visits AS v
LEFT JOIN Transactions AS t
ON v.visit_id=t.visit_id
WHERE t.visit_id IS NULL
GROUP BY  v.customer_id

0개의 댓글