Results 1 to 3 of 3
  1. #1
    cbmorehouse is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    5

    Query to select rows that are the MAX of one column but unique on another

    I'm trying to explain what i'm needing in the best way possible. I've attached a spreadsheet with results from a query I have. I'm wanting to only see the most recent record for each highlighted area based on the "revisionnumber" column. For example, the yellow highlighted rows only need to show line 3. For the green highlighted rows I only want to see row 6; blue rows....row 10; and orange rows....row 13. I've tried grouping all of the columns then putting MAX for the revisionnumber column, but that didn't work. I'm also going to attach the SQL of the query. Any help is appreciated!
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    you need 2 quieries...1 for max, 2nd for all other data
    Q1, get the max:
    select ID, MAX(revNum)

    then Q2 to get all your data using Q1:
    select * from table, Q1 where table.ID = Q1.ID

  3. #3
    cbmorehouse is offline Novice
    Windows 10 Access 2016
    Join Date
    Jun 2018
    Posts
    5
    I'm confused. Am I supposed to just create Q1 with only the ID and the MAX(revNUM)? Then you say to create another query that is selecting the data from Q1. What's the purpose of creating another query to select only two fields that make up Q1?

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

Similar Threads

  1. Replies: 8
    Last Post: 02-08-2016, 11:40 AM
  2. Replies: 4
    Last Post: 12-29-2015, 03:25 PM
  3. Replies: 7
    Last Post: 02-20-2014, 02:34 PM
  4. Replies: 1
    Last Post: 05-15-2012, 05:05 PM
  5. Selecting Unique SETS of rows in Access Query
    By dalessandroh in forum Queries
    Replies: 0
    Last Post: 11-09-2010, 10:42 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