select 顾客ID from (select 顾客ID,group_concat(distinct 产品) as 产品集合 from 销售订单表 group by 顾客ID) t where 产品集合 like '%ProductA%' and 产品集合 like '%ProductB%' and 产品集合 not like '%ProductC%'