今天是
|
 |
欢迎访问中国教育网新版 |
在select语句中使用top的一些小技巧
|
来源: 2008-11-24 16:57:00 |
|
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 |
|
■相关链接
|
 |
|
|
|
|
 |
学习宝库 |
|
 |
热门推荐 |
|
|
|