How to alias a field or column in MySQL?

alias, mysql, subquery

Solution

Consider using a subquery, like:

SELECT col1
,      col1 + field3 AS col3 
FROM   (
       SELECT  field1 + field2 as col1
       ,       field3
       from    core
       ) as SubQueryAlias

Problem

I'm trying to do something like this. But I get an unknown column error: ``` SELECT SUM(field1 + field2) AS col1, col1 + field3 AS col3 from core ``` Basically, I want to just use the alias so that I won't need to perform the operations performed earlier. Is this possible in mysql?

Original source

Related problems