简单的做法:随机取20条记录:select top 20 * from 表 order by newid()

解决方案 »

  1.   

    select * from tableName where 
    id = id * floor((Select count(*) from tableName)/20.0)
      

  2.   

    那你导入个临时表,在临时表中再产生个id
    这样用id整除20如果没有余数的id就取出来
      

  3.   

    select * from tableName where 
     id / ( (Select count(*) from tableName)/20 ) =0
      

  4.   

    select * from tableName bb where ((select count(*) from tablename aa where aa.id<=bb.id)-1)%20=0
      

  5.   

    select * from tableName bb where ((select count(*) from tablename aa where aa.id<=bb.id)-1)%20=0这个可以解决ID不连续的问题,上面各位的只要有跳号就会出错.
      

  6.   

    select * from tableName bb where ((select count(*) from tablename aa where aa.id<=bb.id)-1)%20=0没有关系.:)