2014-10-03 32 views
1

我一直在尋找通過Magento表,我會用什麼字段來抓住前10名買家名字總金額他們每花了。Magento抓住前10名買家

我一直在尋找在flat_order表...

回答

1

如果僅僅有銷售總額和customer_id足夠:

SELECT customer_id,SUM(base_grand_total) AS total_sales 
FROM sales_flat_order 
GROUP BY customer_id 
ORDER BY total_sales DESC 
LIMIT 10; 

如果您需要的客戶信息在同結果,你必須加入一些customer_entity表格,但如果你只是在尋找一個快速報告,上面應該會給你前十名。

P.S.如果您想要綁定客戶數據,請從customer_entity表開始,其名稱似乎在customer_entity_varchar表中。