偶自己写出来了,谢谢大家啦~ select c.orderid,c.total from table c where not exists (select * from (select region,avg(a.total) as regionavg from table a group by region) b where c.region = b.region and c.total < b.regionavg)可能还有更好的办法~
select a.corderid,a.total from table a, (select region,avg(a.total) as regionavg from table a group by region) b where a.region=b.region and a.total>b.regionavg
select c.orderid,c.total
from table c
where not exists
(select *
from (select region,avg(a.total) as regionavg from table a group by region) b
where c.region = b.region and c.total < b.regionavg)可能还有更好的办法~
from table a,
(select region,avg(a.total) as regionavg from table a group by region) b
where
a.region=b.region and a.total>b.regionavg