Need help with query problem

Kluft

New member
Local time
Today, 12:06
Joined
Jul 17, 2003
Messages
7
I have a table that contains the fields CustomerID and InvoiceNo. Any of the customers can have one or more invoices. How can I create a query that shows all customers that have at least 2 invoices? I've already tried writing the expression with operators, but they only refer to a specific value in a record, not to the record itself.
Thanks in advance for any possible solution.
 
Query Help

Try using a gTotalsh query (the ‡” button on the menu bar). Set the Total: field to Count and the Criteria: field to >= 2
 
Ok...I tried that..didn't work..it just kept counting me the records for invoices. The problem is that CustomerID and InvoiceNo. are fields in 2 different tables and there's one-to-many relationship between them.
Thanks for your time.
 
Create a query with the two tables in it. Add the customer from the customer tbl and the invoice number from the other table. For this to work your relationships must be established (but you stated they were).Click on the TOTALS button on the tool bar (loos like a sidways M) and put GROUP BY under the CLIENT NAME. Under the invoice column, switch the GROUP BY to COUNT and put >1 in the criteria field. Now it will return only those individuals names with more than 1 invoice. If you DONT want to see the count displayed in the results, uncheck the box in the query design view.
I think this is what batman26 was trying to explain.
 
Thanks, guys, u were real helpful. I finally got it. It was a bit more complex than that..I had to make 2 queries and link them, though the idea was the same(I mean, what you've told me).
Thanks again:D
 

Users who are viewing this thread

Back
Top Bottom