Select the Top 10 Best-Selling Products

File: ...\Samples\Vfp98\Solution\Data\Topten.qpr

This query displays the top 10 best-selling products based on sales recorded in the Order Items table. The query uses the TOP n feature of the SELECT statement. Because the order is set to DESCENDING, ordering by the sum of price and quantity returns the 10 highest values.

SELECT TOP 10 Products.prod_name,;
  SUM( Orditems.unit_price*  Orditems.quantity);
 FROM testdata!products INNER JOIN testdata!orditems ;
   ON Products.product_id = Orditems.product_id;
 GROUP BY Products.prod_name;
 ORDER BY 2 DESC