If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Microsoft SQL Server > Sum Question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-01-12, 09:40
buzmay buzmay is offline
Registered User
 
Join Date: Jan 2012
Posts: 44
Sum Question

Hi,

I need help with the sum function. I have this query which works just the way I want:

Code:
 
SELECT SUM (SPLIT) FROM CC_SPLIT WHERE COMPANY = 'XXX' AND ACCOUNT ='YYY'
However I would like to do this for all the companies and accounts at the same time rather than needed to write one by one, is this possible?

Thanks in advance

Last edited by buzmay; 02-01-12 at 09:47.
Reply With Quote
  #2 (permalink)  
Old 02-01-12, 09:48
MCrowley MCrowley is offline
Wage drone 24601
 
Join Date: Jan 2003
Location: Massachusetts
Posts: 4,899
Code:
select company, account, sum(split)
from cc_split
group by company, account
Reply With Quote
  #3 (permalink)  
Old 02-01-12, 09:53
buzmay buzmay is offline
Registered User
 
Join Date: Jan 2012
Posts: 44
Thanks a lot
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On