题目
思路
分组聚合(计数),过滤掉购物过的
题解
子查询
# Write your MySQL query statement below
select customer_id, count(customer_id) as count_no_trans from Visits
where visit_id not in (select visit_id from Transactions)
group by customer_id;
左连接
# Write your MySQL query statement below
select customer_id, count(customer_id) 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 customer_id;