Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ikari
Starting Member
2 Posts |
Posted - 2007-12-04 : 07:08:23
|
| Hi I'm new to this forum and I seem to be having a basic problem. I have moved from using MS Access to SQL Server and I seem to be having problem with the SQL below.SELECT Table_A.*, (Statement_A) AS Value_A ,(Value_A + 4) AS Value_BFROM Table_AI keep on getting an error stating invalid column name, I know that statement A is fine because when I move the calculation into Value_B it works. Can anyone tell me what I am doing wrong? |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-12-04 : 07:11:10
|
SELECT Table_A.*, (Statement_A) AS Value_A ,(Statement_A + 4) AS Value_BFROM Table_A E 12°55'05.25"N 56°04'39.16" |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-12-04 : 07:11:34
|
| Since Value_A is a virtual column, you can't refer it in the same SELECT query by its name. Either make it part of derived table or you will have to repeat Statement_A again for calculating Value_B.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
ikari
Starting Member
2 Posts |
Posted - 2007-12-04 : 07:49:40
|
| Thank you for the information. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-04 : 07:51:47
|
| Also note that you can directly use alias name only in Order by caluseMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|