MySQL整体结构全部使用
解体如下:
查询user_id,以及最小日期(date),sum()
select u.user_id,min(u.date),sum(case u.status when 'completed' then 1 else 0 end)as cnt from order_info u where u.product_name<>'JS'and u.date>'2025-10-15' group by u.user_id having cnt>=2 order by u.user_id;