Results 1 to 2 of 2
  1. #1
    mrmims is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jul 2013
    Posts
    53

    Duplicates in Max Date?

    Hello,

    I am trying to run this query:

    Code:
    SELECT LoadTestID, SerialNumberID, Max(DateofTest) AS Last_Load_Test
    FROM TBL_Load_Tests
    GROUP BY LoadTestID, SerialNumberID, LoadTestType
    HAVING (((LoadTestType)=2));
    I have a table (tbl_Load_Tests) which tracks Load Tests on equipment (SerialNumberID). Multiple Load Tests are performed annually on the same SerialNumberID. I want to see the most recent Load Test Date for each SerialNumberID and the LoadTestID (Primary Key for tbl_Load_Tests) created for that Load Test.

    If I run this query without looking for the LoadTestID, it works perfect.
    Code:
    SELECT SerialNumberID, Max(DateofTest) AS Last_Load_Test
    FROM TBL_Load_Tests
    GROUP BY SerialNumberID, LoadTestType
    HAVING (((LoadTestType)=2));

    But when I add in LoadTestID (first code), it returns EVERY Load Test performed and not just the Max Date of each SerialNumberiD.

    What am I doing wrong?

    Thank you for your help!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,641
    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.

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

Similar Threads

  1. MAX Date Records, But No Duplicates
    By Only4Access in forum Queries
    Replies: 2
    Last Post: 04-07-2015, 06:46 PM
  2. Changing from duplicates OK to no duplicates
    By bellczar in forum Access
    Replies: 2
    Last Post: 11-01-2014, 11:40 AM
  3. Replies: 4
    Last Post: 07-15-2013, 12:30 PM
  4. Replies: 9
    Last Post: 06-08-2012, 07:11 PM
  5. Remove duplicates based on date in another column
    By mlhend2002 in forum Programming
    Replies: 5
    Last Post: 12-26-2011, 01:47 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