Results 1 to 6 of 6
  1. #1
    woo8118 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2015
    Posts
    3

    Returning only the highest value

    Hello, I have a query that will populate the correct names but I'm trying to trim down some of them where the last 3 digits are completely random.



    For instance say I have the names
    cat1.103
    cat1.104
    cat4.110
    cat4.120

    The query (like "cat*.1*") returns all 4, but I only care about the highest value of the last 3 digits.. so I would like the query to return cat1.104 and cat4.120

    Any help would be greatly appreciated

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You will have to parse the number portion and order that. I suspect you will have to use an alias and cast the parsed value to a number data type before employing an ORDER BY Keyword.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,943
    The highest value of the 3 digits is 120 so why do you want 104? You want the highest suffix value for each prefix?

    SELECT Left([fieldname],4) AS Category, Max(Mid([fieldname],6)) AS MaxSuffix FROM tablename GROUP BY Left([fieldname],4);
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    woo8118 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2015
    Posts
    3
    My apologies, yes the highest suffix value for each prefix

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,943
    Does query work?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    woo8118 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2015
    Posts
    3
    got it thanks
    Attached Thumbnails Attached Thumbnails query issue.png  

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

Similar Threads

  1. Selecting highest value across several fields
    By megabrown in forum Queries
    Replies: 19
    Last Post: 10-28-2014, 01:16 AM
  2. Query for only the highest level
    By NISMOJim in forum Queries
    Replies: 5
    Last Post: 07-14-2014, 10:25 PM
  3. Find a record with the highest value
    By Lynghaug in forum Queries
    Replies: 3
    Last Post: 06-15-2012, 06:02 AM
  4. Showing highest value
    By Maikelos27 in forum Queries
    Replies: 1
    Last Post: 03-09-2012, 08:40 AM
  5. Select 5 highest values
    By frozendmj in forum Queries
    Replies: 1
    Last Post: 04-19-2011, 03:18 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