方法一:

with t_base as (
select id,user_id,client_id,is_group_buy,cnt 
from
(select id,user_id,product_name,status,client_id,date,is_group_buy,
count(*) over(partition by user_id) as cnt
from order_info 
where product_name in ('c++','java','python') and status = 'completed' and date > '2025-10-15') as t1
where cnt >= 2)

select 
case client_id 
when '1' then 'PC'
when '2' then 'Android'
when '3' then 'IOS'
when '4' then 'H5'
else 'GroupBuy'
end as source,cnt
from(
select client_id,count(id) as cnt 
from t_base 
group by client_id) as t2
order by source