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 |
kellog1
Starting Member
35 Posts |
Posted - 2010-08-16 : 16:50:09
|
Guys,I am trying to calculate running totals and I am getting incorrect results. Below is my query...select PublicationId,ProjectPublicationId, ControlFundingAmount, (select sum(ControlFundingAmount)from DimProjectPublication pp1 where pp1.ProjectPublicationId = pp.ProjectPublicationIdand pp1.PublicationId = pp.PublicationId)from DimProjectPublication ppwhere ProjectPublicationId IN (135750,135211)order by ProjectPublicationIdResult:PublicationId ProjectPublicationId ControlFundingAmount RT43 135211 200000.00 200000.0043 135750 150000.00 150000.00Desired Result:PublicationId ProjectPublicationId ControlFundingAmount RT43 135211 200000.00 200000.0043 135750 150000.00 350000.00 |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2010-08-16 : 19:32:30
|
Cross posting is irritating, but it does get my post count up!JimEveryday I learn something that somebody else already knew |
 |
|
|
|
|