日期:2014-05-17 浏览次数:20700 次
SELECT *
FROM (SELECT A.*, ROWNUM RN
FROM (select a.mc, a.spm, a.xssl, b.xssl1, a.kcsl
from (select tb.name mc, ta.spm, avg(ta.xssl) xssl, ta.kcsl
from CC_JXC_GYS_DAY ta,
(select * from inf_shop where fgs = 'C') tb
where ta.gys = '10035'
and ta.mc = tb.code
and ta.rq < add_months(sysdate, -1)
group by tb.name, ta.spm, ta.kcsl
order by kcsl desc) a,
(select tb.name mc,
ta.spm,
avg(ta.xssl) xssl1,
ta.kcsl kcsl
from CC_JXC_GYS_DAY ta,
(select * from inf_shop where fgs = 'C') tb
where ta.gys = '10035'
and ta.mc = tb.code
and to_char(ta