I agree, I just wasn't thinking clearly when I came up with mine.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
Quote:
> I like JOINs :-), they are fast.
> Viktor
> > Ah, this looks better than mine.
> > --
> > Dirk Goldgar, MS Access MVP
> > www.datagnostics.com
> > (please reply to the newsgroup)
> > > SELECT MyTable.Customer, SUM(MyTable.Amount) AS SumAmount
> > > FROM MyTable INNER JOIN
> > > (SELECT Customer, Min(Number) AS MinOfNumber
> > > FROM MyTable
> > > GROUP BY Customer, Company) AS First
> > > ON MyTable.Customer = First.Customer
> > > AND MyTable.Number = First.MinOfNumber
> > > GROUP BY MyTable.Customer;
> > > Viktor
> > > > i have the following results of a query:
> > > > number customer company amount
> > > > 1 smith msft 100.00 **
> > > > 2 smith msft 100.00
> > > > 3 smith msft 100.00
> > > > 8 smith at&t 250.00 **
> > > > 9 smith at&t 250.00
> > > > 11 smith gte 150.00 **
> > > > 12 smith gte 150.00
> > > > 13 smith gte 150.00
> > > > 1 jones msft 500.00
> > > > 2 jones msft 500.00
> > > > 5 jones adobe 300.00
> > > > 6 jones adobe 300.00
> > > > i want the sum of the amounts of the FIRST occurence
> > > > of the amount for each company pertaining to the
> > > > particular customer.
> > > > from above total sum of amount for smith would be 500.00.
> > > > i can use the SELECT statement with the FIRST
> > > > (table.field) as FirstAmount etc... but can i get the sum
> > > > of the amounts as above.
> > > > thanks for your help
> > > > sm