Subject | Re: [firebird-support] expressions in "order by" clause |
---|---|
Author | Helen Borrie |
Post date | 2005-03-16T10:27:40Z |
At 03:33 PM 16/03/2005 +0600, you wrote:
select
id,
last_name || ', ' ||first_name as MemberName,
extract(year from birth_date) as BirthYear
from aTable
order by 3, 2
is perfectly valid.
In Firebird 1.5, you can also use the degree numbers to GROUP BY.
./hb
>Hello everybodyYes, indeed.
>
>
>
> Firebird SQL allows to use expressions in order by clause, but I haven't
>managed to make it sort by the column number which is a result of
>expression.
>
>
>
> For example:
>
>
>
> select id, name
>
> from my_table
>
> order by (1 + 1)
>
>
>
> this statement will return an unsorted set of results and
>
>
>
> select id, name
>
> from my_table
>
> order by (2)
>
>
>
>the result set will be sorted by "name" value.
>
>
>
>Is it possible to make Firebird sort by the column number which is a result
>of expression?
select
id,
last_name || ', ' ||first_name as MemberName,
extract(year from birth_date) as BirthYear
from aTable
order by 3, 2
is perfectly valid.
In Firebird 1.5, you can also use the degree numbers to GROUP BY.
./hb