题解 | #购买行为分析3#
购买行为分析3
https://www.nowcoder.com/practice/44e9649f40f34e51886d7125860dd88a
此题考点子查询,查询列是否包含了此项,where 筛选列名 in (筛选条件) select distinct 顾客ID from 销售订单表 where 顾客ID in ( select distinct 顾客ID from 销售订单表 where 产品 = 'ProductA' ) and 顾客ID in ( select distinct 顾客ID from 销售订单表 where 产品 = 'ProductB' ) and 顾客ID not in ( select distinct 顾客ID from 销售订单表 where 产品 = 'ProductC' );