Is there anyway to use a column alias in the same SELECT clause which it is being assigned? For example:
SELECT ord_id, candy_id, price, quantity,
price * quantity AS ext_cost, ext_cost * @tax_rate
returns an error because MySQL does not recognize "ext_cost
" in the ext_cost * @tax_rate
query. If it is not possible, is possible to return a table with everything listed in the first query without having to write something like this?
SELECT ord_id, candy_id, price, quantity,
price * quantity AS ext_cost, (price * quantity) * @tax_rate
Basically, I was just wondering if there was anyway to reuse ext_cost
in the SELECT query.