求助,这个sql怎么写?
现在要按行业大类分组,求每组行业中销售额前10名的企业;<br/>Oracle中可以这样写:<br/><br/>select QBXSSR as QBXSSR,HY_DM as HY_DM,NSRDZDAH as NSRDZDAH<br/>from (<br/>select sum(a.QBXSSR) as QBXSSR, SUBSTR(a.HY_DM,1,1) as HY_DM,a.NSRDZDAH as NSRDZDAH,<br/>row_number() over (partition by SUBSTR(a.HY_DM,1,1) order by sum(a.QBXSSR) desc nulls last) as NSRDZDAH_sortn<br/>from FACT_SBXX a<br/>where (a.NSR_SWJG_DM like '121%')<br/>group by SUBSTR(a.HY_DM,1,1),a.NSRDZDAH<br/>order by SUBSTR(a.HY_DM,1,1) nulls first) a<br/>where (NSRDZDAH_sortn<=10)<br/><br/>这里用到了row_number() over (partition by SUBSTR(a.HY_DM,1,1) order by sum(a.QBXSSR) desc nulls last) <br/>请问Sybase IQ中这么写这个sql?<br/><br/>
页:
[1]