select *
from order_info
where user_id in
(
select user_id
from order_info a
where date>'2025-10-15'
and product_name in ('C++','Java','Python')
and status='completed'
group by user_id
having count(user_id)>=2
)
and product_name in ('C++','Java','Python')
and status='completed'
and date>'2025-10-15'
order by id思路:和(二)一样,不过不能使用group by 了,不过我们可以先用group by 把符合条件的user_id 求出来,然后再用判断条件就得到正确答案了。

京公网安备 11010502036488号