Results 1 to 4 of 4
  1. #1
    nubi3 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    2

    how to get data with newest date

    I have this table.
    Prod PurDate Loc
    65 03/25/2013 San Diego
    64 04/25/2013 Los Angeles
    64 01/12/2013 San Francisco
    65 04/25/2013 Sacramento


    and i want to extract records with newest entry on each product (Prod), like this.

    64 04/25/2013 Los Angeles
    65 04/25/2013 Sacramento

    here is what i attempted so far but, the result is not what i want.

    Select Max(Purdate), Prod, Loc
    from products
    group by Prod, Loc

    can anyone suggest a better query?

    thanks,

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    nubi3 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Posts
    2
    thanks pbaldy. can i do it in one SQL statement w/o using a query and joining it with the table? your solutions works great btw.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    The first query could be a subquery to the second, but I feel that gets too messy work with.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Sort Records Via Date (Newest first)
    By tweety in forum Forms
    Replies: 4
    Last Post: 01-28-2013, 09:23 AM
  2. Replies: 8
    Last Post: 09-06-2012, 09:53 AM
  3. Replies: 3
    Last Post: 08-21-2012, 03:05 PM
  4. Replies: 2
    Last Post: 04-27-2012, 05:27 PM
  5. Query From Newest Date
    By SSgtJ in forum Queries
    Replies: 2
    Last Post: 01-21-2010, 01:51 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