首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

怎么在SQL2000 中实现在结果集中加一个表示排名的列 下面是小弟我的SQL 在线急等

2012-02-03 
如何在SQL2000 中实现在结果集中加一个表示排名的列下面是我的SQL在线急等select unitid,unitName,(select

如何在SQL2000 中实现在结果集中加一个表示排名的列 下面是我的SQL 在线急等
select unitid,unitName,(select count(*) from t_news left join t_newstype on t_news.newstypeid=t_newstype.newstypeid where t_newstype.newsTongji=1 and unitId=t_unit.unitId and sysDate > '2007.01.01' and sysDate <'2008.02.01') as newsCount,(select count(*) from t_news left join t_newstype on t_news.newstypeid=t_newstype.newstypeid where t_newstype.newsTongji=1 and unitId=t_unit.unitId and newsState=1 and sysDate > '2007.01.01' and sysDate <'2008.02.01') as newsstatecount from t_unit where unitTypeId=1 order by newsCount desc,unitOrder

[解决办法]
select ranking from (select dense_rank() over(partition by REID order by QUAmount) as ranking,QUID from QU ) as b


你参照一下ranking

热点排行