473,387 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Re: problem with column alias

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

Jul 27 '08 #1
1 2355
On 27 Čec, 23:06, "Plamen Ratchev" <Pla...@SQLStudio.comwrote:
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
Jul 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: war_wheelan | last post by:
I am very new to Transact-SQL programming and don't have a programming background and was hoping that someone could point me in the right direction. I have a SELECT statement SELECT FIXID,...
3
by: olanorm | last post by:
I have a query where one or more of the columns returned is a result from a subquery. These columns get their own alias. I want to filter out the rows containing NULL from the subqueries but it...
3
by: Otie | last post by:
I found the following under the GetObject help notes and in the example for GetObject: "This example uses the GetObject function to get a reference to a specific Microsoft Excel worksheet...
2
by: Stefan Leitich | last post by:
i have the following function: declare prim_col_name Alias for $1; prim_col_val Alias for $2; my_column Alias for $3; link_table Alias for $4; link_col Alias for $5; data_table alias for $6;...
10
by: GML | last post by:
I have a bound datagrid in C# based on an an SQL query. The results are displayed in a Sharepoint 2003 Webpart. I would like to add a new column based on the results of two columns in the...
0
by: Chumley Walrus | last post by:
This is part 2 of my post from last week about getting values in my saleamount column to add up and become a column alias. Below I'm trying to take the amount of all the sales by a salesperson...
2
by: sks | last post by:
Hi all, Is possible to retrieve all columns and alias them all at once. Eg, normally you would write select * from products which would return id | name | price ----------------------- 1...
1
by: deepak | last post by:
Hi There, i have a requiremet ,where in i have a view which has some alias.so at runtime using an application i will get the info about the view using SP_HELP stored proc,but this only gives me...
0
by: imran haq | last post by:
Hi All, I have 3 rather Long Questions that are causing alot of trouble: I would appreciate all the help i can get and tried to use A post sent to atli in the past but it did not help... !) I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.