最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
在select语句中使用top的一些小技巧
时间:2022-06-30 09:31:53 编辑:袖梨 来源:一聚教程网
It's well-known.Microsoft SQL Server 7.0增加了一个语句top,可以限制返回的记录数。但是在使用的时候,有时候会遇到一些问题。
比如希望返回前三名的比分,但是第三名有并列的,使用select top 3 * from table order by score的话就只能返回三条记录,在这样的情况下,就可以使用select top 3 with ties * from table order by score
还有,有的时候我不希望出现重复的记录,那么可以使用select distinct top 3 * from table order by score
比如希望返回前三名的比分,但是第三名有并列的,使用select top 3 * from table order by score的话就只能返回三条记录,在这样的情况下,就可以使用select top 3 with ties * from table order by score
还有,有的时候我不希望出现重复的记录,那么可以使用select distinct top 3 * from table order by score
相关文章
- 对决剑之川诸葛玲珑角色介绍一览 09-20
- 原神奈芙尔角色星级介绍 09-20
- 失控进化防护服获取攻略 09-20
- 失控进化冲锋枪汇总一览 09-20
- 逆战未来猎场传送玩法介绍一览 09-20
- 无限暖暖旧琴谱与即兴节拍协奏任务流程攻略 09-20