SQL排名

来源:互联网 发布:sql 加合计行 编辑:程序博客网 时间:2024/04/29 10:33

select 编号,数量,(select count(*)+1 as 排名 from 表名 b where b.数量>a.数量) as 排名 from 表名 a order by 数量 desc

 

 

 select (select count(*)+1 as OrderTop from Tab_ProdTags b where b.CompeteMoney>a.CompeteMoney and b.TagId=85)
as OrderTop from Tab_ProdTags a where TagId=85 and ProdId=72 order by CompeteMoney desc

原创粉丝点击