What is the use of WITH TIES keyword in SELECT statement in SQL Queries?

前端 未结 7 1425
醉梦人生
醉梦人生 2021-01-30 20:15
SELECT TOP 5 WITH TIES EmpNumber,EmpName 
FROM Employee 
Order By EmpNumber DESC

This above query return more than five result, What is the use of \"Wi

相关标签:
7条回答
  • 2021-01-30 20:50
    SELECT * from myTable order by rank desc fetch first 3 rows With Ties;
    

    gives

    ID    NAME       Rank
    --------------------------
    3    Dhoni     1
    1    Geeks     2
    6    Watson    3     **// We get Tied Row also**
    4    Finch     3
    
    0 讨论(0)
提交回复
热议问题