Question
Please see the screenshot below as well as the instructions. The query is incorrect submitted is incorrect, can you please help me correct this issue?
Please see the screenshot below as well as the instructions. The query is incorrect submitted is incorrect, can you please help me correct this issue?
Instructions: In the Object Explorer pane, scroll down in the list of tables under the AdventureWorks database until you see the Sales.SalesPerson table. Expand Sales.SalesPerson, and then under that, expand the Columns folder to see the list of columns in this table. You will refer to this list in composing your query.
You may also need to refer to the column list for the Person.Person table to get the first and last names.
Referring to the list of columns, enter the SQL code for the desired query in the New Query pane on the right. Your query should display the BusinessEntityID, salesperson FirstName and LastName (from the Person.Person table), and SalesYTD, grouped by BusinessEntityID, FirstName, and LastName, and sorted so that the highest SalesYTD appears at the top.
Refer to the query example of the SQL code for a similar query.
SELECT S.ProductID,Name, FORMAT(SUM(LineTotal),'C')AsTotalSales
FROM Sales.SalesOrderDetail S
JOIN Production.Product P ON S.ProductID= P.ProductID
GROUP BY S.ProductID,Name
ORDER BY SUM(LineTotal) DESC;
Please note, I tried the SQL query sequence below and it was incorrect as well:
SELECT BusinessEntityID, FirstName, LastName, SUM(SalesYTD) as TotalSales
FROM Sales.SalesPerson
JOIN Person.Person ON SalesPerson.BusinessEntityID = Person.BusinessEntityID
GROUP BY BusinessEntityID, FirstName, LastName
ORDER BY SUM(SalesYTD) DESC;
File Edit View Query Project Tools Window Help
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started