select x.cid, x.pid, x.aid, x.ord_qty, y.avg_qty
from (select cid, pid, aid, sum(qty) ord_qty
from orders
group by cid, pid, aid) x,
(select aid, pid, avg(qty) avg_qty
from orders
group by aid,pid) y
where x.aid=y.aid
and x.pid=y.pid
and ord_qty > avg_qty;is it ok?
from (select cid, pid, aid, sum(qty) ord_qty
from orders
group by cid, pid, aid) x,
(select aid, pid, avg(qty) avg_qty
from orders
group by aid,pid) y
where x.aid=y.aid
and x.pid=y.pid
and ord_qty > avg_qty;is it ok?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货