Results 1 to 3 of 3
  1. #1
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398

    exclude the most recent date

    I have a query which returns DISTINCT dates in descending order. Here is an example:
    10/18/13
    10/04/13


    09/20/13
    09/06/13
    08/23/13

    In two weeks from now, the results will be:
    11/01/13
    10/18/13
    10/04/13
    09/20/13
    09/06/13
    08/23/13


    How do I exclude the most recent date? In the second example, I would not like 11/01/13 to be a part of the results.


    Thanks!!

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You should be able to use the same subquery logic posted here in this response today: https://www.accessforums.net/queries...ory-38751.html

    The only difference is, instead of returning records where the date is equal to the Max Value, you want to return the records where it is NOT equal to the Max Date value.

    Give it a try, and see if you can figure it out. If not, post back here.

  3. #3
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    Thanks for the suggestion. Here's what I came up with.

    SELECT DISTINCT PC_LOG.ReportDate
    FROM PC_LOG
    WHERE (((PC_LOG.ReportDate)<>(SELECT DISTINCT TOP 1 PC_LOG.ReportDate
    FROM PC_LOG
    ORDER BY PC_LOG.ReportDate DESC)))
    ORDER BY PC_LOG.ReportDate DESC;

    It works!!

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

Similar Threads

  1. Choose the row with the MOST RECENT date
    By taimysho0 in forum Queries
    Replies: 1
    Last Post: 05-14-2012, 02:35 PM
  2. Adding 5 days to date function but exclude weekends
    By mulefeathers in forum Queries
    Replies: 1
    Last Post: 04-27-2012, 10:28 AM
  3. Replies: 2
    Last Post: 10-08-2011, 06:33 PM
  4. Display Most Recent Date
    By jsimard in forum Queries
    Replies: 2
    Last Post: 06-23-2011, 02:44 PM
  5. Get Recent Record without Id or date
    By pyog in forum Queries
    Replies: 5
    Last Post: 04-19-2011, 09:43 AM

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