select top 1 * from tb where id>(select id from tb where id = 365) order by id asc

解决方案 »

  1.   

    select top 1 from table1 where id not in (select top 12 from table1) 第十三条
      

  2.   

    在数据库中新增一个字段是ID,自增的。那样可以通过ID来得到你的数据!
    select * from T_D where id = (select top1 id from T_D where C1+C2+C3=7)+1
      

  3.   

    to:aspwebchh
    select id from tb where id = 365
    条件所得记录不止一行记录
    Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
      

  4.   

    子查询返回多个值1。这是不允许在子查询如下=,!=,<,<=,>,> =或子查询时,作为一个表达式中使用。
      

  5.   

    不好意思 刚才理解错误  那你可以加个 max函数 取最大的  就可以用 > 了
      

  6.   

    select top 1 * from tb where id>(select top 1 id from tb where id = 1) order by id asc
      

  7.   

    select top 1 * from tb where id>(select  id from tb where id = 1 order by id asc) order by id asc
      

  8.   

    select top 1 * from tb where id>(select top 1 id from tb where id = 1 order by id asc) order by id asc
      

  9.   

    是这个意思??DECLARE @ta TABLE(Name varchar(10),title varchar(20))
    insert into @ta 
    select 'a','123' union all
    select 'a2','345' union all
    select 'a11','231' union all
    select 'a12','12311' union all
    select 'a21','12323'select IDEntity(int,1,1) ID,* INTO #temp from @ta where [name] like '%2%'--满足条件数据
    select * from #temp--满足条件的第二条
    select * from #temp where ID=2drop Table #temp
    /*
    ID          Name       title
    ----------- ---------- --------------------
    1           a2         345
    2           a12        12311
    3           a21        12323(3 行受影响)ID          Name       title
    ----------- ---------- --------------------
    2           a12        12311(1 行受影响)
    */
      

  10.   

    select * into #temp from T_D where C1+C2+C3=7
    select top 1 * from #temp where id not in(select top 12 id from #temp)
      

  11.   

    sql 2005以上的可以用:
      select * from (select row_number() over(order by id) as rownumber,* from T_D where C1+C2+C3=7) A where rownumber=13其中id是必须用来排序的。
      

  12.   

    select top 1 * from tb where id>(select id from tb where id = 365) order by id asc
      

  13.   

    select top 1 from newtable where id < newId