Sum & Group By

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

Hi,

Please help with some SQL. I have a table with vendor_name,Invoice
Date,Invoice Number,Invoice Amount & ID Name. This table has about 300
different Invoice Numbers.

I want to add the Invoice Amount for each of these 300 different
Invoice Numbers & group them by Invoice Numbers .

thanks

newby dave
 
Hi,

Please help with some SQL. I have a table with vendor_name,Invoice
Date,Invoice Number,Invoice Amount & ID Name. This table has about 300
different Invoice Numbers.

I want to add the Invoice Amount for each of these 300 different
Invoice Numbers & group them by Invoice Numbers .

thanks

newby dave

Just create a Query based on the table. Select the Invoice Number and the
Amount. Change the query to a Totals query by clicking the Greek Sigma button
on the toolbar - it looks like a sideways M. Leave the default Group By on the
invoice number, and change it to Sum on the amount.

The SQL would be

SELECT [Invoice Number], Sum([Invoice Amount]) FROM yourtable GROUP BY
[Invoice Number];

Note that I'm answering the question you *asked* - which might not in fact be
the right question. You mention the vendor name and invoice date but don't
indicate what role they play in this problem. Post back if you need more help!
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 
Back
Top