Subject | Expressions/UDFs and Order By |
---|---|
Author | Kevin Morris |
Post date | 2002-10-31T02:52:43Z |
Hello all,
I'm pretty sure I know the answer to my question, but I want to make
sure.
I have a SELECT statement as follows:
SELECT col1, col2,...coln,BIN_OR(col4,324232)*(long math expression)
math_result ORDER BY math_result;
Now, as most of you probably know this query will fail because
the 'math result' alias is illegal in the ORDER BY clause. Instead
one must, find its ordinal position in the column list and use that
in the ORDER BY clause.
For example,
SELECT col1, col2,BIN_OR(col4,324232)*(long math expression)
math_result ORDER BY 3
I know this is no big deal, because one can easily keep track of the
position of the desired expression in the column list, but in my
case where the number of columns in the selects is constantly
changing it's a pain. Is there a way to specify an alias instead of
an ordinal?
If not, is there a forum in which I can appeal to the firebird
developers to include this capability?
Thanks,
Kevin Morris
I'm pretty sure I know the answer to my question, but I want to make
sure.
I have a SELECT statement as follows:
SELECT col1, col2,...coln,BIN_OR(col4,324232)*(long math expression)
math_result ORDER BY math_result;
Now, as most of you probably know this query will fail because
the 'math result' alias is illegal in the ORDER BY clause. Instead
one must, find its ordinal position in the column list and use that
in the ORDER BY clause.
For example,
SELECT col1, col2,BIN_OR(col4,324232)*(long math expression)
math_result ORDER BY 3
I know this is no big deal, because one can easily keep track of the
position of the desired expression in the column list, but in my
case where the number of columns in the selects is constantly
changing it's a pain. Is there a way to specify an alias instead of
an ordinal?
If not, is there a forum in which I can appeal to the firebird
developers to include this capability?
Thanks,
Kevin Morris