知识点
- 还上题一样先筛选条件都一样的
- 分组按照user_id,之后用having进行筛选计数大于等于2的符合
代码
select user_id
from order_info
where date > '2025-10-15'
and product_name in ('C++', 'Python', 'Java')
and status = 'completed'
group by user_id
having count(*) >= 2
order by user_id
select user_id
from order_info
where date > '2025-10-15'
and product_name in ('C++', 'Python', 'Java')
and status = 'completed'
group by user_id
having count(*) >= 2
order by user_id