从Volusion DB导出客户商店积分和积分

时间:2017-04-20 11:55:24

标签: sql csv export volusion

我最近遇到了这种必要性,并且没有关于如何直接执行此操作的明确查询或文档。

1 个答案:

答案 0 :(得分:0)

解决方案是此SQL查询

SELECT c.CustomerID, c.EmailAddress, SUM(g.GiftAmountLeft) AS 'Store Credit', SUM(rph.points) AS 'Reward Points' 
FROM Customers AS c JOIN GiftCards AS g ON c.CustomerID = g.CustomerID 
JOIN Reward_Points_History AS rph ON c.CustomerID = rph.customerid 
GROUP BY c.CustomerID, c.EmailAddress ORDER BY c.CustomerID

这将导出客户ID,电子邮件,商店信用和奖励积分。