Magento 2 SQL queries › Customers
How many customers placed more than one order this year?
Short answer: There's no repeat-customer report in Magento. Group this year's orders by email and count the emails with two or more orders.
In the Magento admin
- Export this year's orders from Sales › Orders to CSV.
- In a spreadsheet, count how many emails appear more than once.
With one query
These queries only read data. Run them on a copy of your database if you can, or ask your developer to. If your tables have a prefix (set in app/etc/env.php), add it to each table name.
Works on Magento Open Source and Adobe Commerce:
SELECT COUNT(*) AS repeat_customers
FROM (
SELECT o.customer_email
FROM sales_order o
WHERE o.state <> 'canceled'
AND o.created_at >= DATE_FORMAT(CURRENT_DATE, '%Y-01-01')
GROUP BY o.customer_email
HAVING COUNT(*) > 1
) r;
Good to know
- Grouping by email counts a guest and a registered account with the same address as one person, which is usually what you want.
- For a repeat rate, divide by the number of distinct emails with at least one order.