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 2005 Forums
 Transact-SQL (2005)
 Get the total sum of multiple columns

Author  Topic 

missMac
Posting Yak Master

124 Posts

Posted - 2009-01-18 : 18:04:09
Hello guys,
I have a query that returns multiple integer values ie

select cost from products where username = 'test' and id = 123


results
0
3
2

How do i get the total of this results into one column, ie the above will be 5

thanks

MM


nathans
Aged Yak Warrior

938 Posts

Posted - 2009-01-18 : 18:07:38
[code]
select sum(cost)
...
[/code]

Nathan Skerl
Go to Top of Page

missMac
Posting Yak Master

124 Posts

Posted - 2009-01-19 : 06:58:24
thanks
Go to Top of Page
   

- Advertisement -