Export customer store credit and points from Volusion DB

159 views Asked by At

I came across this necessity lately and there is no explicit query or documentation on how to do this directly.

1

There are 1 answers

2
Mike On

The solution is this SQL query

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

This will export customer ID, e-mail, store credit and reward points.