问题描述
这是表结构!
name varchar(10),
name varchar(10),
分数浮动
有值:
('Alex',7),('john',5.6),('Tom',8.9),('Anonio',6),('sharti',7),('mamuzi',9)
我需要o/p
name score mamuzi 9 Tom 8.9 Alex 7 sharti 7
当我尝试使用 TOP 作为:select top 3 * from table order by score desc 我无法得到预期的结果
When i try using TOP as : select top 3 * from table order by score desc I can't get the expected results
推荐答案
尝试在 sql server 中使用 with Ties 因为 Alex 和 sharti 具有相同的分数
Try using with Ties in sql server since Alex and sharti have same score
select top 3 with ties * from #t order by score desc