Results 1 to 4 of 4
  1. #1
    Amyfb is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2021
    Posts
    64

    SQL - SELECT MAX versus SELECT LIMIT

    I want to return a list of documents with only the most current version number.

    Seems I should be able to do this one of two ways, but I can't make either work.

    SELECT MAX (fieldname) FROM (qryname) works with a single column query, but not with multi columns.

    SELECT (fieldnames) FROM (qryName) ORDER BY (desc) LIMIT (1) I can't get it to work at all. It works fine till I try to insert the limit condition then it throws a syntax error. I've entered the limit value with and without parentheses or brackets, and I've placed it at different points within the statement, to no avail.



    I'll take any ideas from the group mind here!

    thanks
    Amy

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    I don't think Access supports LIMIT.

    If you want to find multiple records with most recent (maximum) number, review https://support.microsoft.com/en-us/...4-686c216c91d8

    Also http://allenbrowne.com/subquery-01.html#TopN
    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.

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,879
    Can you use Select Top?
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  4. #4
    Amyfb is offline Advanced Beginner
    Windows 10 Office 365
    Join Date
    Mar 2021
    Posts
    64
    Thanks for the inputs. I accomplished the goal with a descending sort on a different column.

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

Similar Threads

  1. Replies: 4
    Last Post: 11-10-2019, 11:10 PM
  2. Replies: 10
    Last Post: 10-26-2019, 12:15 PM
  3. Replies: 9
    Last Post: 01-31-2017, 05:13 PM
  4. Replies: 5
    Last Post: 05-14-2014, 01:17 PM
  5. Replies: 3
    Last Post: 12-14-2013, 12:32 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