i am trying to sum the values for result1 and result2 but it comes up with unknown column result1. Can someone please assist. What am i doing wrong.
SELECT *
,case when event1 = '100mh' then 25.4347*power(sum(18.00-10.40),1.81) end as result1
,case when event2 = 'highjump' then 9.4347*power(sum(14.00-145),1.835) end as result2
,SUM(result1 + result2 )as total
from heptathlon
group by athlete_id