group by query advice

I need a way to identify records in a table. There are 3 key columns of interest, one is "invoice number", one is "amount", and one is "supplier ID". I need a way of grouping records where invoice number and amount are the same for as many rows as that is the case, and then to filter to identify instances where there are more than one supplier ID against the identical invoice number and amount.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

See if this gives you a count of suppliers for Invoice/Amount combinations:

SELECT  InvoiceNumber, Amount, 
(SELECT COUNT(SupplierID)  FROM YourTable b WHERE b.InvoiceNumber = a.InvoiceNumber AND b.Amount = a.Amount)  As NumberOfSuppliers
FROM YourTable a

Open in new window

pma111Author Commented:
that gives a syntax error in access and highlights "(SELECT COUNT(SupplierID)  FROM YourTable b WHERE b.InvoiceNumber = a.InvoiceNumber AND b.Amount = a.Amount)  As NumberOfSuppliers
FROM YourTable a"
pma111Author Commented:
and I did replace fieldnames/table names to our ones.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Can you post your SQL?  (what I posted works for me syntactically)...
Actually... Try this instead.  My last post wont give you distinct suppliers.  Make sure that any field or table names containing spaces or special characters are enclosed in square brackets: [table Name].[Field Name With Spaces]

SELECT Count(q.SupplierID) AS DistinctSuppliers, q.InvoiceNumber, q.amount
FROM (SELECT DISTINCT a.SupplierID, a.InvoiceNumber, a.Amount
FROM Table1 AS a)  AS q
GROUP BY q.InvoiceNumber, q.amount;

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ares KurkluSoftware EngineerCommented:
Try this:
SELECT invoiceNo, Count(SupplierId) AS CountOfSupplierId, max(SupplierId) AS SupId, Amount
FROM Table
GROUP BY invoiceNo, Amount, SupplierId;

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.