Contents
내가 작성한 쿼리
거래를 하지 않고 방문한 사용자의 ID와 이러한 유형의 방문 횟수를 찾기 위한 솔루션을 작성하세요. 결과 테이블을 순서대로 정렬하여 반환합니다.
내가 작성한 쿼리
MySQL, Oracle
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 customer_id; -------------------------------- SELECT customer_id, COUNT(*) AS count_no_trans FROM Visits WHERE visit_id NOT IN ( SELECT visit_id FROM Transactions ) GROUP BY customer_id;
Share article