select top 6 a,b from test
order by b desc;

解决方案 »

  1.   

    select * from test where b in (select top 6 b from test order by b desc)
      

  2.   

    select top 6 a,b from test order by b desc
      

  3.   

    select top 6 a,b from test order by b desc
      

  4.   

    select top 6 a,b from test
    order by b desc
      

  5.   

    select top 6 a,b from test order by b desc
      

  6.   

    select top 6 * from test order by b desc
      

  7.   

    以下适用6.5:set rowcount 6
    select a,b from test order by b desc
    set rowcount 0
      

  8.   

    好象TOP可跟DISTINCT联用,
    select * from test where b in (selecy top 6 b from (select distinct b from test desc) a )
      

  9.   

    select * from test where b in (selecy distinct top 6 b from test desc)
      

  10.   

    select * from test where b in (select distinct top 6 b from test desc)
      

  11.   

    select top 6 distinct a ,b from test  order by b
      

  12.   

    表名:test
    字段1:a
    字段2:b(int)
    写一条满足b字段的值为排名前6个的sql语句排名前6个?从大往小排还是从小往大排,重复的b怎么算?1)共6条从小往大
    select top 6 a,b from test order by b2)共6条从大到小
    select top 6 a,b from test order by b desc3)b可以重复,取前6个不同值,从小到大
    select  a,b from test where b in (select distinct top 6 b from test order by b ) order by b 4)b可以重复,取前6个不同值,从大到小
    select  a,b from test where b in (select distinct top 6 b from test order by b desc) order by b desc