SELECT SalesPersonID,
CASE
WHEN SalesPersonID in
(
SELECT OH.SalesPersonID FROM Sales.SalesOrderHeader OH
WHERE OH.SalesOrderID in
(
SELECT SalesOrderID FROM Sales.SalesOrderDetail OD
	WHERE ProductID = 744
	AND 
	(
		SELECT SUM(UnitPrice * OrderQty) FROM Sales.SalesOrderDetail
		WHERE OH.SalesOrderID = SalesOrderID
	)
	>
	(
		SELECT AVG(Total) FROM  
		(
			SELECT SUM(UnitPrice * OrderQty) AS Total 
				FROM Sales.SalesOrderDetail 
				WHERE SalesOrderID in 
					(SELECT SalesOrderID FROM Sales.SalesOrderDetail
						WHERE ProductID = OD.ProductID)
				GROUP BY SalesOrderID
			) d
		)
	)
)
THEN 'Make Call!'
ELSE 'Relax'
END
FROM Sales.SalesPerson
a
b
c
d
