Subject | Re: [firebird-support] Firebird 2.0 Curiosity |
---|---|
Author | Helen Borrie |
Post date | 2006-12-07T22:48:47Z |
At 08:39 AM 8/12/2006, you wrote:
correct, since you are selecting the same field twice and so there is
ambiguity about which one to ORDER BY.
So, getting the ambiguity exception at the top of the stack may seem
a bit queer..but it reflects the stricter adherence to standards in
Fb 2 DML. Specifically, you can't select the same field more than
once unless you make it a derived field, e.g.
SELECT VALOR,VALOR as VALOR_DERIVED
FROM TAMACONT ORDER BY VALOR
Without the ORDER BY clause, your original statement should throw the
other exception (the number and wording of which I can't access at
the moment, thanks to my network's state being currently "undefined". :-)
In Fb 2.0 you can order on an expression field by its output name,
too, which you couldn't do in Fb 1.5. So you could do this:
SELECT VALOR,VALOR as VALOR_DERIVED
FROM TAMACONT ORDER BY VALOR_DERIVED
./heLen
>Hi there,It is "as designed and documented". The actual error message is
>
>Table TAMACONT has one field only, field name is VALOR.
>
>In Firebird 2.0,
>
>SELECT VALOR,VALOR FROM TAMACONT ORDER BY VALOR
>
>causes this error:
>
>Undefined name.
>Dynamic SQL Error.
>SQL error code = -204.
>Ambiguous field name between a field and a field in the select list
>with name.
>VALOR.
>
>Same statement was working fine in Firebird 1.5.x. It does not affect
>me at all but I thought it was worth mentioning it here.
correct, since you are selecting the same field twice and so there is
ambiguity about which one to ORDER BY.
So, getting the ambiguity exception at the top of the stack may seem
a bit queer..but it reflects the stricter adherence to standards in
Fb 2 DML. Specifically, you can't select the same field more than
once unless you make it a derived field, e.g.
SELECT VALOR,VALOR as VALOR_DERIVED
FROM TAMACONT ORDER BY VALOR
Without the ORDER BY clause, your original statement should throw the
other exception (the number and wording of which I can't access at
the moment, thanks to my network's state being currently "undefined". :-)
In Fb 2.0 you can order on an expression field by its output name,
too, which you couldn't do in Fb 1.5. So you could do this:
SELECT VALOR,VALOR as VALOR_DERIVED
FROM TAMACONT ORDER BY VALOR_DERIVED
./heLen