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 |
|
osirisa
Constraint Violating Yak Guru
289 Posts |
Posted - 2012-01-18 : 15:11:15
|
| I have two calculated columns. I have to create a third calculated column using the values of these two previous calculated columns. But, it doesn't matter how I write the function statement is invalid when I try to enter the calculation portion in the Column property. Select Sales_Dollars*Actual_SVM_percent - Expected_SVMfrom SHP_Project------------------------------------------------Does anyone knows if I can use two calculated columns to create a third calculated column? Thanks, |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2012-01-18 : 15:28:11
|
Perhaps you could place your results within a derived table and then perform the calculations? Something like:SELECT <your last calculation>FROM( --Your query here) d HTH. |
 |
|
|
osirisa
Constraint Violating Yak Guru
289 Posts |
Posted - 2012-01-18 : 15:31:12
|
| Are you suggesting placing the results in a Temp Table? How do I keep update the results and update the new column |
 |
|
|
ehorn
Master Smack Fu Yak Hacker
1632 Posts |
Posted - 2012-01-18 : 15:34:16
|
quote: Originally posted by osirisa Are you suggesting placing the results in a Temp Table? How do I keep update the results and update the new column
I am suggesting you consider a derived table... This is a type of query which allows you to treat what is 'inside the parenthesis' as a base table and perform functions on it as if it were a temp table.You can search for 'derived table' for insights into their syntax and behavior.HTH. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|