比如:
declare @t as table([datas] nvarchar(40)) insert into @t ([datas]) values(n'df'),(n'w4f'),(n'eyy'),(n'er'),(n'gff'),(n'a445') select [datas] from @t order by [datas]
由于我们不清楚datas数据内容,它是动态的内容。但是我们需要获取这表中的某一笔记录,那如何获取呢?
可以使用row_number方法来求得:
select [datas] from ( select row_number() over (order by [datas]) as [rownumber], [datas] from @t) as t where [rownumber] in (2,5)