大虾赐教

解决方案 »

  1.   

    有ID吧,有ID 就用ID between 10 and 20 就是第10行到第20行 
      

  2.   

    从n行到m行select top m *   //先取出前m行
    from tablename
    where id not in( //过滤掉前n行
      select top n id
      from tablename
    )
      

  3.   

    呵呵,楼上的也是对的,我的方法只适用ID没有规律,比如10到20里面可能只有一到两个ID,其它的被删除了,ID只要不重复就可以了,并非一定要所有的数字都存在。
      

  4.   

    oracle:select   *   from   table1   where   rownum   <=   n   
    minus   
    select   *   from   table1   where   rownum   <=   m;
    sql server:select   top   n   *   from   
    (select   top   m   *   from   tablename   order   by   columnname)   a 
    order   by   columnname   desc 
      

  5.   

    1、简单处理:id的编号和行号保持一致查询id就是了。2、缓存处理(DataTable)读取数据到内存表,然后对表就行操作(这个没问题吧,问题简化了)3、sql分页功能根据需要,分成几页,显示你需要那一页就行了(授之以鱼,不如授之以渔)-特提供此思想,望楼主自行揣摩,用代码实现之。祝你好运
      

  6.   

    看你的版本和数据库类型。。可以利用rownum查询
      

  7.   

    -51 - 100 
    select top 49 * from 
    (select top 100 * from
    dbo.Table_1 order by t1 ) a
    order by t1 desc
      

  8.   

    从n行到m行select top m * //先取出前m行
    from tablename
    where id not in( //过滤掉前n行
      select top n id
      from tablename
    )对...这个
      

  9.   

    select * from (select *,row_number.ever(order by ) as rownumber from xxx) where rownumber between 10 and 20 
      

  10.   

    从第M行开始 到第N行
    select top n *  where not exist(select top * m from table)
    大概是这样吧   先筛前N行 然后再把前M行去掉  N>M
      

  11.   

    select top(m-n)* from tablename where id not in (select top n id from tablename)
      

  12.   

    从n行到m行:
    select top(m-n)* from tablename where id not in (select top n id from tablename)
    比如第10行到15
    tablename表中id假如依次为:1  3   4  5  6  8  9  10  11  12  13  14  16  19  28
    那么他查出来的结果就是id为13  14  16  19  28的那几行数据。
      

  13.   


    常用的是rownumber();效率适中!!如果追求效率就用
    select   top   n   *   from   
    (select   top   m   *   from   tablename   order   by   columnname)   a 
    order   by   columnname   desc 
      

  14.   

    要看是什么数据啊
    sql server 2005 直接用 row_number()了如果是  access  sql server2000之类的,那就要自己计算行号,生成派生表,再查询
      

  15.   


    select top(20) * from xfq_SurveyQuestionAnswer where id not in(select top(10) id from xfq_SurveyQuestionAnswer)
      

  16.   

     --查询输入第m条-第n条出租房屋信息
    select   top (m-n) * from hos_house where HMID  not in(select  top m HMID from hos_house) 
    select top (m-n) * from hos_house where HMID between n and m