Magento 2 SQL queries › Customers
How many customers registered this month, per customer group?
Short answer: Filter the customer grid by Customer Since and group, or count customer_entity rows by group in one query.
In the Magento admin
- Go to Customers › All Customers › Filters.
- Set Customer Since from the 1st of this month and pick one Group at a time.
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 g.customer_group_code AS customer_group, COUNT(*) AS new_customers
FROM customer_entity c
JOIN customer_group g ON g.customer_group_id = c.group_id
WHERE c.created_at >= DATE_FORMAT(CURRENT_DATE, '%Y-%m-01')
GROUP BY g.customer_group_id, g.customer_group_code
ORDER BY new_customers DESC;
Good to know
- Customers imported or created by an integration count too, on the day they were created.
- To split by website, add
c.website_idto the SELECT and GROUP BY.