Get the Top Data with Ties from SQL Server (If there are same data….Ties in data will happen. If we need all the data.

In this scenario you need to use With Ties option


13a.png


In the second query, I've given Top 3 data. But the third and fourth data is having a tie up which inturn enables the query engine to fetch both the data which are in Ties.

·         WITH TIES OPTION MAY CAUSE MORE THAN THE SPECIFIED NUMBER OF RECORDS TO BE DISPLAYED

·         BECAUSE IT DISPLAYS ALL OF THE RECORDS MATCHING THE LAST RECORD'S ORDER BY CLAUSE