Why isn't there a way to reference column aliases in the columns list or
where clause?
Example:
select if(score<50,-5,0) failing_score, if(score>50, 1, 0) passing_score,
attendance/totaldays Percent_Attendance ,
failing_score/passing_score*percent_attendance
from schoolwork
(There is no logic to the columns so please don't try to replace the code
with something simpler)
The problem is I have some very complex expressions for several columns and
if I want to reference them again in an expression-let's say I need to sum
the column expressions 1 through 10, I have to repeat the entire
expression. Why? If I gave the column an alias, why can't I refer to that
alias in the column expression?
So the column aliases are ignored if I try and reference them in the
Columns list or in the Where clause, but they are recognized if used in the
Order By clause.
Why?
TIA
Mike
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]