Saturday, April 26, 2014

what's wrong with my code?


SELECT TOP 1 e.EmployeeID
FROM Employees e
INNER JOIN Orders o
ON o.EMployeeID = e.EmployeeID
INNER JOIN (SELECT OrderID,SUM((UnitPrice * Quantity) - Discount) AS TotalOrderPrice
FROM [Order Details]
GROUP BY OrderID
)oi
ON oi.OrderID = o.OrderID
GROUP BY e.employeeid
ORDER BY SUM(TotalOrderPrice * 0.1) DESC,COUNT(o.OrderID) ASC





Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://ift.tt/19nLNVq http://ift.tt/1iEAj0c


No comments:

Post a Comment