Here is the questions:
I have an Access db with a sample file containing invoices paid.
I need to write a report that groups payment of equal amounts (Use GrossAmt) for each vendor together.
Ignore the sign (positive or negative) of the amount. Ignore groups with only one record.
For each vendor show a group header containing the vendor number and name.
For example if the GrossAmt is $100 in one record and the GrossAmt is $-100 in another record treat that as a match.
Here is the answer that I wanted some clarification on the sql:
SELECT ApTest.VenNum, Abs(ApTest.GrossAmt) AS [Gross Amount Duplicate], ApVenTest.VenName, ApTest.InvNum AS InvNum, ApTest.DueDte, ApTest.PaidDte
FROM ApTest INNER JOIN ApVenTest ON ApTest.VenNum = ApVenTest.VenNum
GROUP BY ApTest.VenNum, ApTest.GrossAmt, ApVenTest.VenName, ApTest.InvNum, ApTest.DueDte, ApTest.PaidDte
HAVING (((ApTest.VenNum) In (SELECT [VenNum] FROM [ApTest] As Tmp GROUP BY [VenNum], Abs([GrossAmt]) HAVING Count(*)>1 And Abs([GrossAmt]) = Abs([ApTest].[GrossAmt]))))
ORDER BY ApTest.VenNum, Abs(ApTest.GrossAmt);