Query maximum values

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I asked this before, but got an answer in sql - can anyone help with giving
me something I can use in the expression builder?

Tables are connected by CustNo field. Table2 has multiple records for each
customer CustNo. There is another field (dates) called Service_To. I need
to pull only the records with the most recent Service_To date.

As there are multiple customers it appears I can't simply sort and pull the
"top", unless I am misunderstanding something.


--
Regards,

Bryan Brassell
Padgett Business Services
281-897-9141
 
Copy the SQL into the SQL Window, then click on the QBE view. :P Sorry,
dork humor.

Because you want to find the Top per group, the only way to do this in a
single query is with a subquery. There are other ways to do it, but they
would be more complicated than the subquery. Like multiple queries or VBA.
 
I think this is what you want.
First query as totals set for Max on the Service_To date.
Second query left join Service_To to MaxOfService_To of the first query.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

First 200 Query 6
excluding records 2
Select Criterion - wildcard 1
Query Max Value 2
count rows with data 4
CurDir 5
Max Dates Query 1
counts rows in data 7

Back
Top