Subject | Re: [firebird-support] Table name vs. field alias |
---|---|
Author | Svein Erling Tysvaer |
Post date | 2009-04-23T17:44:31Z |
Well, yes, from Firebird 2.1 it is allowed to order by alias. Taken from
the release notes:
Order By or Group By <alias-name>
Column aliases are now allowed in both these clauses.
Examples:
1. ORDER BY
SELECT RDB$RELATION_ID AS ID
FROM RDB$RELATIONS
ORDER BY ID
2. GROUP BY
SELECT RDB$RELATION_NAME AS ID, COUNT(*)
FROM RDB$RELATION_FIELDS
GROUP BY ID
Your query is the same as the first of these, except that you select a
constant that you call rdb$database (AS is an optional keyword).
Set
Gabor Boros wrote:
the release notes:
Order By or Group By <alias-name>
Column aliases are now allowed in both these clauses.
Examples:
1. ORDER BY
SELECT RDB$RELATION_ID AS ID
FROM RDB$RELATIONS
ORDER BY ID
2. GROUP BY
SELECT RDB$RELATION_NAME AS ID, COUNT(*)
FROM RDB$RELATION_FIELDS
GROUP BY ID
Your query is the same as the first of these, except that you select a
constant that you call rdb$database (AS is an optional keyword).
Set
Gabor Boros wrote:
> Hi,
>
> This query working with FB (2.1.2):
> SELECT 1 RDB$DATABASE FROM RDB$DATABASE ORDER BY RDB$DATABASE
>
> Is this a feature?
>
> Gabor