/* SELECT DISTINCT (SELECT CAST(P.ProductID AS VARCHAR(80))+P.Name FROM Production.Product P WHERE P.ProductID=D1.ProductID) AS '²£«~', D1.OrderQty FROM Sales.SalesOrderDetail D1 WHERE OrderQty= (SELECT MAX(OrderQty) FROM Sales.SalesOrderDetail D2 WHERE D1.SalesOrderID=D2.SalesOrderID) */ SELECT S.SalesOrderID, S.OrderDate, D.SalesPersonID, (SELECT FirstName+' '+MiddleName+' '+LastName FROM Sales.vSalesPerson AS VS WHERE VS.SalesPersonID=D.SalesPersonID) AS 'SalesName' FROM Sales.SalesOrderHeader AS S INNER JOIN (SELECT SalesPersonID, MAX(SalesOrderID) AS 'SalesOrderID' FROM Sales.SalesOrderHeader GROUP BY SalesPersonID ) AS D ON S.SalesOrderID=D.SalesOrderID ORDER by OrderDate