日期:2014-05-18 浏览次数:20464 次
with temp as ( select region, avg([order]) as avgOrder from test group by region ) select test.* from test inner join temp on temp.region = test.region where test.[order] > temp.avgOrder
------解决方案--------------------
SELECT * FROM orders AS o WHERE `order` > (SELECT AVG(`order`) FROM orders WHERE o.region=region)