Question: Please Provide an answer in MYSQL workbench Write a SELECT statement that totals all the invoice amounts by SupportRepId. Return the supportrepid and the total.
Please Provide an answer in MYSQL workbench
Write a SELECT statement that totals all the invoice amounts by SupportRepId. Return the supportrepid and the total. Sort the results so that the support rep id with the largest total of invoices is at the top.
invoice table:
columns:
| InvoiceId | int(11) AI PK |
| CustomerId | int(11) |
| InvoiceDate | datetime |
| BillingAddress | varchar(70) |
| BillingCity | varchar(40) |
| BillingState | varchar(40) |
| BillingCountry | varchar(40) |
| BillingPostalCode | varchar(10) |
| Total | decimal(10,2) |
Customer table:
culomns:
| CustomerId | int(11) AI PK |
| FirstName | varchar(40) |
| LastName | varchar(20) |
| Company | varchar(80) |
| Address | varchar(70) |
| City | varchar(40) |
| State | varchar(40) |
| Country | varchar(40) |
| PostalCode | varchar(10) |
| Phone | varchar(24) |
| Fax | varchar(24) |
| varchar(60) | |
| SupportRepId | int(11) |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
