SELECT
x.source,
count(x.source)
from
(SELECT
oi.id,
oi.product_name,
oi.is_group_buy,
case when c.name is null then 'GroupBuy' else c.name END AS"source",
COUNT(*)over(partition by oi.user_id)mm
FROM order_info oi
LEFT JOIN client c ON c.id = oi.client_id
where datediff(oi.date,"2025-10-15")>0
  and oi.status ="completed"
  and oi.product_name in("C++","Java","Python")
  ORDER BY oi.id)x
  WHERE x.mm>=2
  GROUP BY x.source
  ORDER BY x.source