第二大的
select * from t a where (select count(*) from where 字段>a.字段)=1
第三大的
select * from t a where (select count(*) from where 字段>a.字段)=2

解决方案 »

  1.   

    第n大的
    select * from t a where (select count(*) from where 字段>a.字段)=n
      

  2.   

    不对 应该加distinct
    第二大的
    select * from t a where (select count(distinct(字段)) from where 字段>a.字段)=1
    第三大的
    select * from t a where (select count(distinct(字段))  from where 字段>a.字段)=2
    select * from t a where (select count(distinct(字段))  from where 字段>a.字段)=n
      

  3.   

    某个字段第二大的数.第三大的select top 2 字段 from tb where 字段 not in(select top 1 字段 from tb) order by 字段