select 类别ID, 价格总和/产品数量 as 单价 from ( select 类别ID, SUM(单价*库存量) as 价格总和, SUM(库存量) as 产品数量 from Product group by 类别ID ) t where 价格总和/产品数量 > 20;