I want to select the highest value, I have joined two tables and I want to be able to find the highest value as well as the persons first name.
I have my column called SalesYTD
which is in my Sales.Salesperson
table. And my Firstname
column which is in my person.person
table.
I want to find only the highest value in the SalesYTD
table and display it along with the persons Firstname
.
I've tried the following query:
SELECT FirstName, MAX(SalesYTD) AS YTD
FROM Person.Person
JOIN Sales.SalesPerson ON Person.Person.BusinessEntityID = Sales.SalesPerson.BusinessEntityID
GROUP BY FirstName, SalesYTD