I am having problems with a multiple join query...
While this query produces an erroneous result due to no aliases defining multiple joins, it does run:
This query attempts to solve the erroneous result with aliases; but, produces an error: [COLOR=red yellow]#1109 - Unknown table 'points_service' in field list[/color]
Can anyone help with my syntax please?
TIA,
Allen M.
While this query produces an erroneous result due to no aliases defining multiple joins, it does run:
Code:
SELECT users_vins.vin, users_vins.reg_date, Sum( points_service.points ) AS service_reward, Sum( points_sales.points ) AS sales_reward
FROM users_vins
INNER JOIN points_service ON users_vins.acct_no = points_service.acct_no
INNER 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
This query attempts to solve the erroneous result with aliases; but, produces an error: [COLOR=red yellow]#1109 - Unknown table 'points_service' in field list[/color]
Code:
SELECT users_vins.vin, users_vins.reg_date, Sum( points_service.points ) AS service_reward, Sum( points_sales.points ) AS sales_reward
FROM users_vins
INNER JOIN points_service AS service ON users_vins.acct_no = points_service.acct_no
INNER JOIN points_sales AS sales ON users_vins.acct_no = points_sales.acct_no
GROUP BY users_vins.acct_no, vin
ORDER BY users_vins.acct_no ASC
Can anyone help with my syntax please?
TIA,
Allen M.