请教 select top x with ties.....的用法
今天看了本书,上面说了一下with ties这种用法,我自己
测试
create table cc
(id int identity(1,1),
name varchar(10),
sort int
)
insert into cc select 'a',21
union all select 'b',21
union all select 'c',22
union all select 'd',22
union all select 'e',22
union all select 'f',23
union all select 'g',26
select top 3 with ties id,name,sort from cc order by sort
---结果是
id name sort
1 a 21
2 b 21
3 d 22
4 e 22
5 f 22
不明白结果为什么是这样,能解释它的用法吗!!