Question
What are the largest amounts for a sale item (SalePrice * Quantity) made to each customer (first and last names) during November 2015. Name the
What are the largest amounts for a sale item (SalePrice * Quantity) made to each customer (first and last names) during November 2015. Name the column MaxAmount.
My Code I currently have is
select C.CustomerID, FirstName,LastName, Max(SalePrice) AS MaxPrice, Max(Quantity) as MaxQuantity from Customer C Join Sale S on C.CustomerID = S.CustomerID JOIN SaleItem SI ON S.SaleID = SI.SaleID where Year (SaleDate)= 2015 group by C.CustomerID,FirstName,LastName;
my FIRST ATTEMPT I HAD CODE LIKE
SELECT Sale.* FROM Sale JOIN SaleItem ON Sale.SaleId = SaleItem.SaleId WHERE (SaleDate) =11
Received errors like this
Ignoring case, "Max" could not be found in the query. (-1) Ignoring case, "SalePrice" could not be found in the query. (-1) Ignoring case, "Quantity" could not be found in the query. (-1) Ignoring case, "Month" could not be found in the query. (-1) Ignoring case, "Year" could not be found in the query. (-1) "2015" could not be found in the query. (-1) Ignoring case, "group by" could not be found in the query. (-1) The system was unable to execute your query so it could not evaluate if it produces the correct number of rows. (-6) The system was unable to execute your query so it could not evaluate if it produces the correct number of rows where MaxAmount=150. (-1) The system was unable to execute your query so it could not evaluate if it produces the correct number of rows where MaxAmount=75.2. (-1) The system was unable to execute your query so it could not evaluate if it produces a column named FirstName. (-1) The system was unable to execute your query so it could not evaluate if it produces a column named LastName. (-1) The system was unable to execute your query so it could not evaluate if it produces a column named MaxAmount. (-1) Found in the following section(s) of the text:
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