2

Maybe it's a novice question, but I am trying to get the sum of balances for each account present in the table.

I am trying the below

Select 
    SUM(BALANCE)  
from
    dbo.account_balances  
where 
    ACCT IN (
            1000, 1001, 1002...)  

This is giving me the total balance and I can see why. I need help in figuring out how to see the balances for each account individually in query result.

I do not have the rights to modify the table. There are no NULLs.

5

That's easy:

Select ACCT, SUM(BALANCE)
from dbo.account_balances
where ACCT IN ( 1000, 1001, 1002...)
GROUP BY ACCT
|improve this answer|||||

Not the answer you're looking for? Browse other questions tagged or ask your own question.