Results 1 to 2 of 2

Thread: How would I write this query?

  1. #1
    Join Date
    Mar 2006
    Posts
    29

    How would I write this query?

    We have a bunch of clients. For each client there is more than one matter linked to that client. I need to find the matter for each client that has THE MOST time logged against it. I was thinking I should use the Totals functions to do this. I tried using the "MAX" function on the time and the "Last" and "First" functions. I still see the same client with several matters showing in the query results when I use these functions. I need ONE client with the ONE matter that has the most time against it.

    Any ideas??

    Thanks!!

  2. #2
    Join Date
    Mar 2006
    Posts
    29
    So, I ended up finding something in Access help entitled "Find the record with the top or bottom value within each group". It directed me to drop the matter from the query to select the top values just by the client. I changed the "1" to "all" in the top values and used "max" for the hours. Once I got the result, I relinked the client and the time amount back to the matter. It did create some duplicates but I guess out of 5,500 records that isn't too bad.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •