Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2011
    Posts
    10

    Query to return only the row containing the highest date.

    I would like to return only the row with the latest date, but because some of the other fields have changed, all rows are returned. How can I get past this problem?



    I have a table containing problem classifications. There is a foreign key, the classification of the problem, as well as the date the problem was classified.

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    select top 1 from table order by datefield desc

  3. #3
    Join Date
    Jan 2011
    Posts
    10
    Thanx, that works but I am not quite out of the woods yet.

    Let me explain:

    I have a query that populates a subform, and this serves as a dashboard for outstanding issues.

    Each issue can have a classification, but classifications can change and therefore I need the latest one. I therefore join to a query as opposed to a table. The advise you had already given works fine, but as a nested query (joined on the ticket id) it does not work.

    See screenshot. And thanx for the help so far!

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    define "it does not work".

  5. #5
    tuyo is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    9
    im kind of stuck in the same problem of getting record with the latest date. i cannot seem this out. ive tried vba and queries in sql but im always stuck at the same point. help pls!

    a little overview about the proj:
    its an inventory. upon filling a form, i want it to automatically fill the opening balance with the latest ending balance IF the item in the form exists.

    guidance pls.

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 return for date ranges.
    By Desstro in forum Queries
    Replies: 2
    Last Post: 09-14-2010, 06:44 AM
  3. return last updated date for each product
    By jonnyuk3 in forum Queries
    Replies: 0
    Last Post: 06-17-2009, 04:38 AM
  4. Replies: 4
    Last Post: 01-29-2009, 02:43 AM
  5. query to find the highest value in a field
    By jhjarvie in forum Queries
    Replies: 0
    Last Post: 09-02-2008, 02:27 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