Results 1 to 3 of 3
  1. #1
    lokiluke is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    6

    remove Left Join duplicates

    Hi all, First off i am new to SQL and access. i have a database that has two related tables, tblAssets and tblTests. they are linked one to many by the Primary and foreign key tblAssets.AssetID and tblTests.AssetID.



    i have written a simple LEFT JOIN to match up tblTests.TestDate with its appropriate AssetID

    Code:
    SELECT tblassets.assetid, tbltests.testdate
    FROM tblAssets LEFT JOIN tblTests ON tbltests.AssetID=tblAssets.AssetID
    as there are multiple entries for each asset in the tblTests i would like show only the latest date for each AssetID. i have tried googling but to no avail. i have tried using MAX(tblTests.Testdate) but this only locates the max date in the table, not for each group of assetID.

    any hints on how to acheive this

    Cheers,
    luke

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Create an aggregate query and group on the assets with a Max on the date. Here is a tutorial that explains.

    http://www.techonthenet.com/access/queries/index.php

    Scroll down to the group by features and click on Max.

    Alan

  3. #3
    lokiluke is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2011
    Posts
    6
    cheers, exactly what i needed. have been playing round with the max() but the tutorial showed me where i was going wrong.

    thanks,
    alan

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

Similar Threads

  1. Left Join not
    By j_a_monk in forum Queries
    Replies: 5
    Last Post: 08-07-2011, 09:47 AM
  2. inner, left or right join ?
    By toqilula in forum Access
    Replies: 0
    Last Post: 04-11-2011, 12:20 AM
  3. Remove Duplicates Based on Criteria
    By suryaprasad in forum Access
    Replies: 0
    Last Post: 04-07-2011, 10:50 PM
  4. Replies: 3
    Last Post: 02-02-2011, 01:00 PM
  5. How to remove duplicates
    By TonyBender in forum Access
    Replies: 0
    Last Post: 10-21-2009, 10: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