select
a.id as id,
a.is_group_buy as is_group_buy,
case
when a.is_group_buy = 'No' then c.name
when a.is_group_buy = 'Yes' then null
end as client_name
from
(select
*,
count(*) over(partition by user_id) as counts
from
order_info
where
date > '2025-10-15' and status = 'completed' and product_name in ('C++','Java','Python')) a
left outer join
client as c
on
c.id = a.client_id
where
a.counts >= 2
order by
a.id asc;

京公网安备 11010502036488号