次の方法で共有


Select the 10 Worst-Selling Products Sample

File: ...\Samples\Data\Worstten.qpr

This query displays the 10 worst-selling products based on sales recorded in the Order Items table. The query uses the TOP n feature of the SELECT statement, and, because the default order is from smallest to largest, ordering by the sum of price and quantity returns the 10 lowest 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

See Also

Tasks

Select the Top 10 Best-Selling Products Sample

Solution Samples

Reference

Visual FoxPro Foundation Classes A-Z

Other Resources

Views and Queries Solution Samples