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 2008 Forums
 Transact-SQL (2008)
 Setting Variable to SUM

Author  Topic 

CoffeeAddict
Yak Posting Veteran

94 Posts

Posted - 2009-11-06 : 15:10:04
Trying to figure out how to get this set:

set @TotalPts = select SUM(someField) from orders where completedDate is not null and customerID = @customerID

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2009-11-06 : 15:15:35
[code]set @TotalPts = (select SUM(someField) from orders where completedDate is not null and customerID = @customerID)[/code]or[code]select @TotalPts = SUM(someField) from orders where completedDate is not null and customerID = @customerID[/code]
Go to Top of Page

CoffeeAddict
Yak Posting Veteran

94 Posts

Posted - 2009-11-06 : 15:17:09
Thanks I knew I had to be close!
Go to Top of Page
   

- Advertisement -