Reputation: 191
I am trying to combine 3 tables in one query with MySQL. However, I'm getting an error saying that the column name is ambiguous.
gndsale.AMOUNT is a column from another table named gndsale and the word AMOUNT is from gndtndr.
Error: Column 'amount' in field list is ambiguous
Here is my code:
SELECT g.ID
, concat(emp.FIRSTNAME, ' ', emp.LASTNAME) Fullname
, FORMAT(ROUND(SUM(s.AMOUNT), 2),0) as DECLARED
, FORMAT(ROUND(SUM(amount), 2),0) as CALCULATED
, `DATE`
, `CHECK`
FROM gndtndr g
JOIN emp
ON emp.ID = g.ID
JOIN gndsale s
on g.ID= S.ID
group
by EMPLOYEE
Upvotes: 0
Views: 97
Reputation: 95
Why don`t you use ROUND(SUM(gndtndr.AMOUNT), 2),0)
Upvotes: 1