获取某一行数据
程序员文章站
2022-06-17 08:55:44
比如: 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)
下一篇: Python环境的安装