You have a table named SALES with the following columns:

You have a table named SALES with the following columns:

SalesmanID | ProductsSold
1 | 2000
2 | 4000
3 | 5000
4 | 5000
5 | 6000
6 | 6000
7 | 9000
8 | 9000

You have to chose a query that will select all SalesmanIDs that have sold an amount of products within the 3 top ProductsSold values.

You have a table named SALES with the following columns:

SalesmanID | ProductsSold
1 | 2000
2 | 4000
3 | 5000
4 | 5000
5 | 6000
6 | 6000
7 | 9000
8 | 9000

You have to chose a query that will select all SalesmanIDs that have sold an amount of products within the 3 top ProductsSold values.

A.
SELECT TOP(3) WITH TIES
SalesmanID, ProductsSold
FROM Sales
order by ProductsSold

B.
SELECT TOP(30) PERCENT
WITH TIES
SalesmanID, ProductsSold
FROM Sales
order by ProductsSold

C.
SELECT SalesmanID
From Sales
where ProductsSold in (Select TOP 3 ProductsSold
From Sales)

D.
Select TOP (3) ProductsSold, SalesmanID
From Sales

Explanation:
http://msdn.microsoft.com/en-us/library/ms189463.aspx

SYNTAX:
[
TOP (expression) [PERCENT]
[ WITH TIES ]
]

WITH TIES

Specifies that additional rows be returned from the base result set with the same value in the ORDER BY columns appearing as the last of the TOP n (PERCENT) rows. TOP…WITH TIES can be specified only in SELECT statements, and only if an ORDER BY clause is specified.



Leave a Reply 0

Your email address will not be published. Required fields are marked *