select * from yourtable where id between 30 and 40 

解决方案 »

  1.   

    前提至少得知道表中主键吧?
    假设表明为tableA,主键为id
    Oracle中这样:
    select id from tableA
    where id not in(select id from tableA where rownum<=30) 
    and id  in (select id from tableA where rownum<=40)
    SQLServer中,现在没有环境,无法测试,大概这样吧
    select id from tableA 
    where id not in (select top 30 id from tableA )
    and id in (select top 40 id from tableA)
      

  2.   

    天胜的应该可以!
    select id from tableA 
    where id not in (select top 30 id from tableA )
    and id in (select top 40 id from tableA)
      

  3.   

    那就select * from yourtable where id between 30 and 40啊
      

  4.   

    dui .有数字主键的话.楼上最简单
      

  5.   

    select * from yourtable where id between 30 and 40
    THIS IS NOT RIGHT.
    Because the id can be "30,31,35,37,39,40",thus you can only get six records by that SQL sentence.
    But with my SQL sentence,you can get exactly ten records from database.
      

  6.   

    that sentence can use any primary key,not only numeric type key,but also varchar or others types.Such as product_id,which may be varchar type in database defination.
    Sorry that I can only input Englis because I havn't a Chinese input method.
      

  7.   

    Oracle中这样:
    select id from tableA
    where id not in(select id from tableA where rownum<=30) 
    and id  in (select id from tableA where rownum<=40)
    SQLServer中,现在没有环境,无法测试,大概这样吧
    select id from tableA 
    where id not in (select top 30 id from tableA )
    and id in (select top 40 id from tableA)这个应该可以的.
      

  8.   

    select top 40 * from table order by id
    int i=0;
    假设取得结果集为result
    while(result.next())
    {
    if(i>=30)
    {
    if(i>40) break;
    vector.add(result.getString("列名"));//Vector vector=new Vector();}
    i++;
    }
    你试试吧,当循环到第30次开始存入vector,当大于40时退出循环
      

  9.   

    用top来分页啊,就像oracle中rownum一样的
      

  10.   

    先rs.absolute(29) 然后for(int j=0;j<10;j++)
         {
            if(rs.next())
            {
    试试
      

  11.   

    如果有ID顺序的话:
    select * from table where id between 30 and 40;如果没有顺序的话我觉得可以这样用
    select top 40 from table
    然后程序中的:
    ResultSet.absolute(30);
    while(ResultSet.next())
        ...
      

  12.   

    基本语句
    select top 40 * from table order by id(或者是其他的)