获取某一行数据
程序员文章站
2022-03-20 19:23:36
比如: 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 ......
比如:
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)
上一篇: golang channel 源码剖析
下一篇: easyui 前端实现分页 复制就能用