T-SQL小问题
我想让SQL查询返回一个数据集,这个数据集是表中的第10行到第20行中的数据,怎么写?
前几行的我会写,是TOPx,这个怎么写啊?
问题点数:10、回复次数:2Top
1 楼xeqtr1982(Visual C# .NET)回复于 2006-03-29 20:02:36 得分 9
declare @t table([id] int,[name] varchar(10))
insert into @t select 1 , 'aa'
union all select 2 , 'cc'
union all select 3 , 'aa'
union all select 4 , 'bb'
union all select 5 , 'rr'
union all select 6 , 'tt'
--例如取3-6的记录
select top 4 * from (select top 6 * from @t)a order by [id] descTop
2 楼TombFigure(美丽人生)回复于 2006-03-29 20:19:45 得分 1
楼上的正解Top




