就要有多个这样的子查询,太复杂了,有没简单的办法?
select n_prt_no,n_brh_no,n_num1,
(select pm from (select n_brh_no,
rank() over(order by n_num1 desc) pm1,
rank() over(order by n_num2 desc) pm2
from t_rpt
where n_prt_no = a.n_prt_no
and d_opr_date = to_date('20171001', 'yyyy-mm-dd')
) where a.n_brh_no = n_brh_no )
from t_rpt a
where n_prt_no =1 and d_opr_date = to_date('20171001', 'yyyy-mm-dd')