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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 problem select (5 + 6) as b, (b + 6) as c;

Author  Topic 

filipecorreia
Starting Member

3 Posts

Posted - 2004-04-22 : 07:59:11
Can anyone help me with this simple query
select (5 + 6) as b, (b + 6) as c;

how can I build a column with the AS function and the use that column in the same query.

thank you

samsekar
Constraint Violating Yak Guru

437 Posts

Posted - 2004-04-22 : 08:08:00
You cant do like that...

Select b, (b + 6) as c from (select (5 + 6) as b) as T

- Sekar
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2004-04-22 : 08:14:53
or just

select (5 + 6) as b, ((5 + 6) + 6) as c;
Go to Top of Page

drymchaser
Aged Yak Warrior

552 Posts

Posted - 2004-04-22 : 08:47:15
declare @b int

select @b = (5+6)

select @b as b, (@b + 6) as c;
Go to Top of Page
   

- Advertisement -