select rownum XH0000, b.* from (select a.*,SF_SS_GETWSFSL(a.SSDH00,1,1) WSFSL0 from VW_SS_MZFYLB a where YYSSRQ >='20220711' and YYSSRQ<='20220711' and nvl(SSMZKS,'1704')='1704' and exists (select 1 from BM_BMBM00 where BMBH00=a.SSKS00 and YYID00='620001') order by WSFSL0 desc,SQKS00,XM0000 asc,YYSSRQ desc) b