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 |
pyram
Starting Member
12 Posts |
Posted - 2012-04-11 : 18:14:28
|
Hi, I have a table like this:Create Table Test1 ( Column1 Varchar(20) ,Column2 Varchar(20),Column3 Varchar(20))I inserted some data in the table. And i do select query that outputs this result:John-------1----2Jessica----3----7What i would like is an output like this:John-------1----2---3Jessica----3----7---10So it will add the first two numbers and it will display the total at the end.How can i do this?thanks... |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2012-04-11 : 18:20:06
|
SELECT Column1, Column2, Column3, CAST(Column2 as int) + cast(Column3 as int)FROM Test1 |
 |
|
pyram
Starting Member
12 Posts |
Posted - 2012-04-11 : 18:29:22
|
quote: Originally posted by robvolk SELECT Column1, Column2, Column3, CAST(Column2 as int) + cast(Column3 as int)FROM Test1
thanks a lot! |
 |
|
|
|
|