Hello,

Is there a way to generate a column which computes a value from other
columns in the same query?  For example, I want to do something similar to:

SELECT
 MIN(table.myvalue) as min,
 MAX(table.myvalue) as max,
 min/max as derived_column
FROM
 table
ORDER BY
 derived_column
;

But MySQL doesn't like the references to the "min/max" aliases in the
computation of the "derived_column" column.  Is there a way to directly
refer to the values generated by other columns in this manner?

The example I gave is trivial, and theoretically I could generate
"derived_column" with "MIN(myvalue)/MAX(myvalue)".   But in practice, I'd
like to use this to refer to columns which generate values from much more
complex expressions.

Thanks in advance,

-- Dan

Reply via email to