假设表为sales,name,kind,price依次表示为名称,种类,价格。select * from sales a where exists (select 1 from (select name,kind,avg(price) avg_price from sales group by name,kind) b where a.name=b.name and a.kind=b.kind and (a.price>=b.avg_price*0.9 or a.price <=b.avg_price*1.1))
from sales a where exists (select 1 from
(select name,kind,avg(price) avg_price from sales group by name,kind) b
where a.name=b.name and a.kind=b.kind and (a.price>=b.avg_price*0.9 or a.price <=b.avg_price*1.1))