Re: How to identify a column in order by clause

From: Mikito Harakiri <mikharakiri_at_iahu.com>
Date: Fri, 7 Jan 2005 08:41:51 -0800
Message-ID: <X8zDd.25$Df7.100_at_news.oracle.com>


"DA Morgan" <damorgan_at_x.washington.edu> wrote in message news:41deb545$1_3_at_127.0.0.1...
> The best solution is, as always, positional notation
>
> SQL> ed
> Wrote file afiedt.buf
>
> 1 select table_name, column_name AS COLNAME
> 2 from user_tab_columns
> 3 where table_name = 'SERVERS'
> 4* ORDER BY 2
The positional notation is misborn ANSI SQL invention. Why is that

select table_name, column_name AS COLNAME from user_tab_columns
where table_name = 'SERVERS'
ORDER BY 2 is different from

select table_name, column_name AS COLNAME from user_tab_columns
where table_name = 'SERVERS'
ORDER BY 1+1 Received on Fri Jan 07 2005 - 17:41:51 CET

Original text of this message