Open Jacobvu84 opened 9 months ago
select customer_id, count(v.visit_id) as count_no_trans
from Visits as v
left join Transactions as t on v.visit_id = t.visit_id
where t.transaction_id is null
group by customer_id
SELECT customer_id, COUNT(visit_id) as count_no_trans
FROM Visits v
WHERE NOT EXISTS (
SELECT visit_id FROM Transactions t
WHERE t.visit_id = v.visit_id
)
GROUP BY customer_id