I have a database which stores 2 types of "points" for various users identified by both equipment serial #'s or "vins" as well as by account #'s
I am attempting to generate a report showing the SUM of two types of points available for each serial number.
Although the query below executes fine and the "reward" result is correct, the sales_reward sum of points_sales.points is always incorrect.
Any help resolving how I made a mistake crafting this query would be appreciated...
TIA,
-A
I am attempting to generate a report showing the SUM of two types of points available for each serial number.
Although the query below executes fine and the "reward" result is correct, the sales_reward sum of points_sales.points is always incorrect.
Any help resolving how I made a mistake crafting this query would be appreciated...
Code:
SELECT users_vins.vin, users_vins.reg_date, Sum( points_service.points ) AS reward,
Sum( points_sales.points ) AS sales_reward
FROM users_vins
INNER JOIN points_service ON users_vins.acct_no = points_service.acct_no
JOIN points_sales ON users_vins.acct_no = points_sales.acct_no
GROUP BY users_vins.acct_no, vin
ORDER BY users_vins.acct_no ASC
TIA,
-A