Results 1 to 2 of 2
  1. #1
    giannirusso is offline Novice
    Windows 8 Access 2003
    Join Date
    Mar 2017
    Posts
    1

    Update query for each id

    Hello, sorry for my english.



    Im a newbie and I need some help for my access database.

    If I need to return the top date for each id that can have multiple dates, like this:

    ID DATE
    1 05/02/2005
    1 06/03/2006
    3 10/11/2004
    3 11/12/2007

    The code can be:

    Code:
    SELECT TOP 1 * FROM [table]
    ORDER BY table.[Date] DESC;
    And the result should be:

    1 06/03/2006
    3 11/12/2007


    Now, if I would like to update the MAXDATE column in the source table with the top date, like this :

    ID MAXDATE
    1 06/03/2006
    1 06/03/2006
    3 11/12/2007
    3 11/12/2007

    How can I do it?
    I need this for having a query based on a table who can be updated.

    Thanks
    Gianni

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,527
    create a make table query of the ID , MAX(date), so the results are in their own table.
    then create an update table, join the temp table to the data table (on ID) to update the dates.

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

Similar Threads

  1. Replies: 1
    Last Post: 10-27-2016, 12:14 PM
  2. Replies: 14
    Last Post: 08-12-2014, 06:33 AM
  3. Replies: 7
    Last Post: 08-26-2013, 06:05 AM
  4. Replies: 2
    Last Post: 08-30-2012, 07:59 AM
  5. Replies: 4
    Last Post: 11-10-2011, 03:41 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