Expression needed for similar names in a field

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top