/*This SQL script uses the Demo database.
  This sample illustrates how to arrive at the totals for
  the number of sales and the value of those sales for
 each customer in the "Sales"  table.
*/

SELECT 
  COUNT(Sales.Company) AS "Sales",
  SUM(Sales.Qty * Sales.ListPrice) AS "Amount",
  SUM(Sales.Qty * Sales.Cost) AS "Cost",
  Sales.Company,
  Sales.Addr1 AS "Mailing Address",
  Sales.Addr2 AS Suite,
  Sales.City,
  Sales.State,
  Sales.Zip
FROM
 Sales
GROUP BY
  Sales.Company
ORDER BY
  "Amount" DESC