Ask a Question
Advertise on boostr.in
using an alias in sql calculations using -'mysql,sql,database'
using an alias in sql calculations ¬†using -'mysql,sql,database'
Why won't this query work?
SELECT 10 AS my_num, my_num*5 AS another_number
In this example, I'm trying to use the my_num alias in other calculations. ¬†This results in unknown column "my_num"
This is a simplified version of what I am trying to do, but basically I would like to use an alias to make other calculations. ¬†My calculations are much more complicated and thats why it would be nice to alias it since I repeat it several times different ways.
Sep 7, 2015
to add a comment.
Your name to display (optional):
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
To avoid this verification in future, please