Hi
Is it possible to re-use the content of a column that is just created in
the SELECT statement? Here an example
SELECT (complicated formula) AS result, name, surname,
IF(result>16,'OK','NO') AS verdict FROM my_table
This doesn't work, because mySQL does not find the "result" column. I
know it would be possible to put directly the "complicated formula"
inside the IF statement, but since I intend to have multiple such
statements, it would be nice not having to copy-paste it X times.
I tried to use it by using variables, but it doesn't work because
variables can not be set and read in the same statement.
Any idea how I could do this?
Thanks!
--
Thomas Guignard
Acoustics and Electromagnetism Lab
Swiss Federal Institute of Technology, Lausanne