Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2013
    Posts
    14

    Simple Max Date Question

    I cant tell you how much you all are teaching me and I am GRATEFUL.

    From the below table I need a query that returns only the max date for each different MPI.


    Test Table
    MPI policy_start_date
    75918 10/1/1999
    75918 12/9/2014
    179938 12/22/2009
    179938 5/1/2015
    179938 10/2/2015
    67980 4/1/2015
    67980 5/1/2015
    67980 10/15/2015
    266811 4/1/2014
    266811 5/1/2015
    255531 12/9/2014
    255531 6/1/2014
    66049 10/15/2015
    66049 10/1/1999
    66049 5/1/2015

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Do an Aggregate (Totals) Query.
    - Create a new query
    - Add the two fields you show above
    - Click on the Totals icon in the Query Builder (looks like a Sigma)
    - Change the Totals line entry of "Group By" under the policy_start_date field to "Max"

    View your results.
    This "Groups" your data by the MPI field, and takes the Max date value of each distinct group.

  3. #3
    Join Date
    Aug 2013
    Posts
    14
    Thanks for you reply.

    Will this work if I have more fields in the query?

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Yes. Those would just have the phrase "Group By" under their total rows too.
    Just be aware that it will have a listing for each distinct combination of all your Group By fields. So you want to be careful not to include any fields that you want ignored in your grouping.

  5. #5
    Join Date
    Aug 2013
    Posts
    14
    Thanks so much!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Simple sql question
    By mrdave9 in forum Access
    Replies: 4
    Last Post: 07-13-2015, 02:16 PM
  2. Replies: 5
    Last Post: 06-13-2015, 04:29 PM
  3. If and Else - very simple question
    By tygereye in forum Access
    Replies: 38
    Last Post: 04-02-2014, 06:06 AM
  4. Simple Date Format Question
    By EHittner in forum Queries
    Replies: 1
    Last Post: 03-10-2013, 04:46 PM
  5. Simple question?
    By roads.zx in forum Access
    Replies: 0
    Last Post: 10-15-2009, 04:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums