Most RDBMSes won't let you use a column alias in the same scope as it is defined (pretty sure the SQL standard itself doesn't specify that it should be allowed). You can get around this by using a CTE.
Also, optimisers aren't stupid, the actual sum() function will not be recalculated.
Also, optimisers aren't stupid, the actual sum() function will not be recalculated.