Expression needed for similar names in a field

G

Guest

I have a 2 field query created and want to create a third field with a
calculation/expression. One field is the company name and the other field has
the sales total for each invoice. There are multiple entries in the company
name field for the same company. (ex company A has 5 records with 5 different
invoice amts). I want access to sum up the sales totals for each comany and
put the total in a separate field. How do I write expressions to group items
by the same name?

Company sales sales total by company
Company A $525 $1025
Company A $500
Compnay B $200 $400
Company B $200

Any help would be much appreciated
 
G

Guest

Try

Select T1.Company, T1.sales ,(Select Sum(T2.sales) As S1 From TableName As
T2 Where T2.Company = T1.Company) As [sales total by company] From TableName
As T1

Will return :

Company sales sales total by company
Company A $525 $1025
Company A $500 $1025
Compnay B $200 $400
Company B $200 $400
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top