Top selling products in Magento

Best-selling Magento products by ordered quantity and revenue.

Magento · PostgreSQL
SELECT soi.name AS product,
       SUM(soi.qty_ordered) AS units_sold,
       ROUND(SUM(soi.row_total), 2) AS revenue
FROM sales_order_item soi
WHERE soi.parent_item_id IS NULL
GROUP BY soi.name
ORDER BY revenue DESC
LIMIT 20;

How it works

Aggregates the sales_order_item table by product. Excludes parent configurable lines to avoid double counting.

Run this on your own database

BeQuery mirrors your Magento MySQL database to an isolated PostgreSQL copy, so you can run queries like this one without ever touching production.

Start free No credit card