|
Home > Archive > SQL server exams > November 2002 > Coco's question of the week #20
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Coco's question of the week #20
|
|
| cocolocopolo 2002-11-07, 12:30 am |
| To create a report of the salespeople who had the 20 highest total sales, the correct answer shows:
Select Top 20 With Ties LastName, FirstName, SUM (OrderAmount) AS ytd
From Sales
Group By LastName, FirstName
Why use 'With Ties' ??? | |
| 2lazybutsmart 2002-11-08, 12:17 pm |
| the question dictates that you should display salespersons with the 20 highest sales. WITH TIES is used to get all salespersons who have made sales equal to the 20th person. so if the and 20th and 21st both have a sales amount of 1000, you will have them both in your result set.
If you ommit WITH TIES, you will not get salespersons who have made sales equal to the 20th person.
WITH TIES..... That's what it means. GET me all the records that have tied this one in the criteria.
peace.
2lazybutsmart | |
| cocolocopolo 2002-11-09, 1:50 am |
| Thanks dear 2lazybutsmart. |
|
|
|
|