본문 바로가기

IT/코딩테스트

[Leetcode] 1581. Customer Who Visited but Did Not Make Any Transactions

728x90

https://leetcode.com/problems/customer-who-visited-but-did-not-make-any-transactions/

SELECT A.customer_id, COUNT(A.visit_id) AS count_no_trans
FROM Visits as A
LEFT JOIN Transactions as B
ON A.visit_id = B.visit_id
WHERE B.transaction_id IS NULL
GROUP BY A.customer_id;

 

728x90