select a.*,(select count(*) from 表 where 正确数目>=a.正确数目) as 名次 from 表 a
你要的是这一个 select *,((select count(distinct 正确数目) from Table B where B.正确数目<A.正确数目)+1) AS 名次 from Table A这是另外的排名次的方法,与你的要求不同 select *,((select count(1) from Table B where B.正确数目<A.正确数目)+1) AS 名次 from Table A
http://expert.csdn.net/Expert/topic/2483/2483747.xml?temp=.2146417
select *,((select count(distinct 正确数目) from Table B where B.正确数目<A.正确数目)+1) AS 名次
from Table A这是另外的排名次的方法,与你的要求不同
select *,((select count(1) from Table B where B.正确数目<A.正确数目)+1) AS 名次 from Table A