Hi,
I am having a sum problem.
When I try and SUM two columns together I get an error, see my code below:
SELECT ID
, sum( IF (Cards.Card = 'Yellow', 1, 0) ) AS "YellowCard"
, sum( IF (Cards.Card = 'Red', 1, 0) ) AS "RedCard"
, sum( YellowCard ) + sum( RedCard ) AS "Total"
FROM Cards
The following error:
#1054 - Unknown column 'YellowCard' in 'field list'
Any suggestions will be greatly appreciated.
Thanks,
C.