我需要mysql查询帮助,我想检索我们的Magento(CE v1.7.0.2)客户生命时间值。
实际上是客户从开始到现在分成几个月的平均总订单数。
感谢
答案 0 :(得分:1)
你可以试试这样的
SELECT DISTINCT customer_email, customer_firstname, customer_lastname,
SUM(subtotal_invoiced) AS Total
FROM `sales_flat_order` AS a
GROUP BY customer_email
ORDER BY SUM(subtotal_invoiced) DESC