Last active
February 19, 2017 20:27
-
-
Save gbdavid2/aa67355176bd5ac586dc to your computer and use it in GitHub Desktop.
adventureWorks: Retrieve data about latest orders by customer name, date and filtered by sales person 289 (ordered and grouped by date and customer name)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT TOP 10 P.FirstName +' '+P.LastName As ClientName, SOH.OrderDate | |
FROM Sales.SalesOrderHeader SOH | |
JOIN Sales.Customer C ON SOH.CustomerID = C.CustomerID | |
JOIN Person.Person P ON P.BusinessEntityID = C.PersonID | |
WHERE SalesPersonID = 289 | |
GROUP BY P.FirstName +' '+P.LastName, SOH.OrderDate | |
ORDER BY SOH.OrderDate DESC, P.FirstName +' '+P.LastName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment