Erehwon Posted December 24, 2009 Share Posted December 24, 2009 Greetings - I've got the basics down of adding up data - but I have run across a need for some advanced work that i need some help with/.Given:Customer Amount ----------- ---------A 5.00B 2.00A 3.00B 2.00C 1.00I need to write a query that will sum the totals for client a, client b,client c. Here's the kicker - I don't want the output to be individual lines for those clients rather the totals - as belowOutput:\Customer Amount ----------- ---------A 8.00B 4.00C 1.00Anyone have a suggestion? Link to comment Share on other sites More sharing options...
Erehwon Posted December 24, 2009 Author Share Posted December 24, 2009 Not so hard I guess :-)Base logic:SELECT Customer,SUM(OrderPrice) FROM OrdersGROUP BY CustomerApplied to my situation:SELECT COMPANY_NAME,SUM(monthly_inv_amt) as BILLEDFROM AGR_Invoice_Amt INNER JOIN AGR_Header ON AGR_Invoice_Amt.AGR_Header_RecID = AGR_Header.AGR_Header_RecID INNER JOIN Company ON AGR_Header.Company_RecID = Company.Company_RecIDWHERE (AGR_Invoice_Amt.Year_Nbr = '2009') AND (AGR_Invoice_Amt.Month_Nbr = '11')GROUP BY company_nameORDER BY BILLED DESCHope this helps someone out there Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now