SQL Server中选出指定范围行的SQL语句代码
时间:2024-01-28 08:39:14
在数据库查询的时候,我们有时有这样的需求,就是要找出数据表里指定范围行内的数据记录,比如说要找出数据表里第10行到第20行的这10条数据,那么我们怎么来实现呢?
按照通常的方法是实现不了的,我们得借助于临时表以及一个函数来实现
代码如下:
Select no=Identity(int,1,1),* Into #temptable From dbo.teacher_info order by teacher_name--利用Identity函数生成记录序号
Select * From #temptable Where no>=10 And no < 20
Drop Table #temptable--用完后删除临时表
这样我们就实现了我们的目的。
标签:SQL,Server,指定范围行,SQL语句
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
tensorflow入门:tfrecord 和tf.data.TFRecordDataset的使用
2022-06-29 16:23:40
![](https://img.aspxhome.com/file/2023/3/86553_0s.jpg)
Python实现的对一个数进行因式分解操作示例
2023-01-11 04:30:40
Python从零开始创建区块链
2021-02-12 12:21:14
![](https://img.aspxhome.com/file/2023/3/92203_0s.jpg)
python中列表添加的四种方法小结
2023-12-10 21:59:47
![](https://img.aspxhome.com/file/2023/7/71337_0s.png)
js特效,页面下雪的小例子
2024-04-22 22:32:21
python 并发编程 非阻塞IO模型原理解析
2022-03-11 06:55:54
![](https://img.aspxhome.com/file/2023/8/133818_0s.png)
可以输入的下拉菜单
2009-01-04 14:21:00
Keras 切换后端方式(Theano和TensorFlow)
2023-05-30 22:35:03
Python实现字符串格式化输出的方法详解
2023-05-02 20:52:59
Pytorch实现ResNet网络之Residual Block残差块
2022-11-17 15:00:02
python实现数值积分的Simpson方法实例分析
2023-08-01 17:35:01
浅析SQL语句中GROUP BY的用法
2024-01-28 21:36:51
Python的log日志功能及设置方法
2022-03-28 22:13:32
Python实现将Word表格嵌入到Excel中
2022-02-10 06:21:49
![](https://img.aspxhome.com/file/2023/8/133858_0s.png)
python ocr简单示例之识别验证码
2021-05-01 18:16:40
![](https://img.aspxhome.com/file/2023/3/123483_0s.jpg)
修改Python的pyxmpp2中的主循环使其提高性能
2022-07-22 15:26:53
js,jquery滚动/跳转页面到指定位置的实现思路
2024-04-10 16:19:54
Python 自由定制表格的实现示例
2023-11-11 16:54:41
SQL Server数据库对服务器的需求
2010-06-11 13:52:00
python数据化运营的重要意义
2021-05-05 21:02:27