Re: Inconsequences in SELECT/ORDER BY
Posted in 1994
Topics: Stored Procedures & SPL
In article <2nttv6$3r4@maicgn.SoftwareEngineering> ar@mai.de (Achim Reiners) writes:
>Hello Informixers!
>
>I had a little problem with an ORDER BY clause:
>
>First of all I use the possibility to SELECT a column more than once
>in a SELECT-statement:
>
>SELECT col_a, col_b, col_a FROM tab;>
>This works fine and makes life easier for me (really!).
>
>Now I tried: SELECT col_a, col_b, col_a FROM tab ORDER BY col_a;
>
>I received the "ambiguous column" - error. I think that in this context
>this error should NOT be reported.
>
>O.K. the workaround is quite easy using "display labels".
>( SELECT col_a ca1, col_b, col_a ca2 FROM tab ORDER BY ca1; )
>
>What is the opinion of the net? Is the error reporting correct or not?
I have no problem with it reporting an error. It's just asking which column(s)
you want your data sorted by...
BTW, you could also do:
SELECT col_a, col_b, col_a FROM tab ORDER BY 1;--
-------------------------------------------------------------------
* Bob Beaulieu (bobb@netcom.com) eztravel@netcom.com *
* Tel: 408-978-0808 Fax: 408-978-7024 *
* Corporate Travel Services *
-------------------------------------------------------------------