select * from t1 where userId >1
------------------
为了取出第m条到第n条记录,请问怎么样把这个语句写完整

解决方案 »

  1.   

    加上標示列,where id between m and n就可以了
      

  2.   

    select * from sysobjects a where (select id from sysobjects where id=a.id) between 1 and 9试试看这个
      

  3.   

    是不是有误解??
    我说的是满足where条件里面的第m条到第n条.
    可是你们说的是从第m条到第n条里面去按条件取数据
      

  4.   

    SELECT TOP n-m+1 * 
    FROM Table 
    WHERE (id NOT IN (SELECT TOP m-1 id FROM Table ))  
      

  5.   

    我是sqlserver2000,
    楼上的id是什么啊,是一个字段名吗?我的表里面没有id这个字段啊
      

  6.   

    SELECT TOP n-m+1 * 
    FROM Table 
    WHERE (id NOT IN (SELECT TOP m-1 id FROM Table )) 
    table 就是你的数据表
    id    就是你表主键
      

  7.   

    --取8.9.10三行记录的方法,前提,编号是主键才行select top 3 *
    from gzda a
    where 编号 in (select top 7 编号 from gzda order by 编号 desc)
    order by 编号 desc
      

  8.   


    select identity(int ,1,1) as id, * into #a from authors
    select * from #a where id between 10 and 19
    drop table #a
      

  9.   

    select identity(int ,1,1) as id, * into #a from authors
    select top 10 * from #a where id not in(select top 9 id from #a)
    drop table #a