Connecting Tech Pros Worldwide Help | Site Map

Re: problem with column alias

  #1  
Old July 27th, 2008, 10:15 PM
Plamen Ratchev
Guest
 
Posts: n/a
You cannot use a column alias in the definition of another column. The
solution is as you found to repeat the expression. Alternative solution is
to define the first column in one CTE (or derived table) and then use the
column in a second CTE.

Also, it is good to define a valid column name (not a revered keyword) and
then change it to whatever you want in the final SELECT (or client
application).


Plamen Ratchev
http://www.SQLStudio.com

  #2  
Old July 27th, 2008, 10:15 PM
Jan Hudecek
Guest
 
Posts: n/a

re: Re: problem with column alias


On 27 Čec, 23:06, "Plamen Ratchev" <Pla...@SQLStudio.comwrote:
Quote:
You cannot use a column alias in the definition of another column. The
solution is as you found to repeat the expression. Alternative solution is
to define the first column in one CTE (or derived table) and then use the
column in a second CTE.
>
Also, it is good to define a valid column name (not a revered keyword) and
then change it to whatever you want in the final SELECT (or client
application).
>
Plamen Ratchev
Thank you, you're probably right about that keyword..
Jan
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: problem with column alias --CELKO-- answers 0 July 29th, 2008 04:45 PM
problem with Group By sangram.0149@gmail.com answers 5 March 18th, 2006 02:35 PM
Problem with reader Dmitri Manushin answers 1 November 17th, 2005 08:38 PM
Problem with SQL query Nicolas Payre answers 3 July 19th, 2005 09:56 PM