declare @table table (id int,col varchar(1)) insert into @table select 1,'a' union all select 2,'b' union all select 3,'c' union all select 4,'d'select * from @table/* id col ----------- ---- 1 a 2 b 3 c 4 d */--条件id=2 declare @id int set @id=2; select * from @table where id=@id /* id col ----------- ---- 2 b */--得到下一条数据 select * from @table where id=@id+1 /* id col ----------- ---- 3 c */--条件id>2 select * from @table where id>@id--得到下一条数据 --没有下一条--条件id<2 select * from @table where id<@id--下一条就是 select * from @table where id=@id--你说的条件是什么样的条件呀?
select top 1 * from Table where ID>10 and 其他条件
select top 1 * from tb where id>(select top 1 id from tb where 1=1 order by id desc)
declare @table table (id int,col varchar(1))
insert into @table
select 1,'a' union all
select 2,'b' union all
select 3,'c' union all
select 4,'d'select * from @table/*
id col
----------- ----
1 a
2 b
3 c
4 d
*/--条件id=2
declare @id int
set @id=2;
select * from @table where id=@id
/*
id col
----------- ----
2 b
*/--得到下一条数据
select * from @table where id=@id+1
/*
id col
----------- ----
3 c
*/--条件id>2
select * from @table where id>@id--得到下一条数据
--没有下一条--条件id<2
select * from @table where id<@id--下一条就是
select * from @table where id=@id--你说的条件是什么样的条件呀?
select top 1 * from tb where id>(select top 1 id from tb where 1=1 order by id desc)