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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-06-01 : 07:36:10
|
| Samuele writes "If I've created a computed column, how can I use it in the same query?Example:Select (Sell + Stock) as Tot,(Tot + Buy) as Tot2 From ArticleI've got an error when I try to use the column Tot in the second column.This are query made in Access and I have to translate all in Sql Server. I know that I can use "(Sell + Stock + Buy) as Tot2" but it's right this thing that i'd like to skip.Thanks Samuele" |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2004-06-01 : 07:58:45
|
| [code]Select (Sell + Stock) as Tot,((Sell + Stock) + Buy) as Tot2 From Article[/code] |
 |
|
|
mohdowais
Sheikh of Yak Knowledge
1456 Posts |
Posted - 2004-06-01 : 08:03:15
|
Or use a derived table to make life even easier:SELECT Tot, (Tot + Buy) AS Tot2 FROM (SELECT (Sell + Stock) AS Tot, Buy FROM Article) A OS |
 |
|
|
|
|
|