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 |
|
HeyZain
Starting Member
7 Posts |
Posted - 2010-02-04 : 00:39:22
|
| Hi folks,Could somebody guide me with example how can i add the values of two computed columns to make a third computed column?I am using SQL Server 2005 dev. edition.Thanks & Regards,Zain.Z@in |
|
|
binto
Yak Posting Veteran
59 Posts |
Posted - 2010-02-04 : 01:03:08
|
| Try thisDECLARE @T TABLE (value int,rate int)INSERT @TSELECT 3,6UNION ALL SELECT 5,6UNION ALL SELECT 7,34UNION ALL SELECT 9,23UNION ALL SELECT 23,22UNION ALL SELECT 22,12UNION ALL SELECT 18,32UNION ALL SELECT 34,43SELECT value,rate, (value+rate) as result FROM @TThanks & RegardsBinto Thomas |
 |
|
|
HeyZain
Starting Member
7 Posts |
Posted - 2010-02-04 : 02:22:37
|
| Thanks a lot binto.. Exactly what i needed. :)Z@in |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-04 : 03:15:14
|
if you want to perform operations b/w two computed columns, it should beSELECT c,d,c*100.0/dFROM(SELECT a,b, (a + b) as c, (a- b) as d FROM table)t |
 |
|
|
|
|
|
|
|