Results 1 to 6 of 6
  1. #1
    hklein is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    15

    deletion with join


    Hello, I would like to make a query which deletes those records from table1, which are not included in table2. Tables can be linked with an ID field. Thanks for any help

  2. #2
    jwill is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Mar 2012
    Location
    MD
    Posts
    67
    Hey hklein,

    This should work

    Code:
    delete * FROM t1 where t1.id not in (select t2.id from t2);

  3. #3
    hklein is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    15
    Hello,
    thank you, shouldn't I use any join...?

  4. #4
    jwill is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Mar 2012
    Location
    MD
    Posts
    67
    I'm not sure if there is a performance benefit, but using the where clause to "join" tables instead of the JOIN keyword is done sometimes and as long as it gets you to the same result w/o a big hit on performance.....

  5. #5
    hklein is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2011
    Posts
    15
    Hello,
    thanks for your time and help. It works smoothly

  6. #6
    jwill is offline Advanced Beginner
    Windows Vista Access 2010 64bit
    Join Date
    Mar 2012
    Location
    MD
    Posts
    67
    No problem

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

Similar Threads

  1. Many-to-Many Self Join
    By neo651 in forum Access
    Replies: 4
    Last Post: 09-20-2012, 02:25 PM
  2. Replies: 2
    Last Post: 02-29-2012, 12:51 AM
  3. Outer Join Nested in Inner Join
    By Stevens7 in forum Queries
    Replies: 2
    Last Post: 10-19-2011, 01:34 PM
  4. Avoid column deletion in datasheet
    By dinorbaccess in forum Forms
    Replies: 6
    Last Post: 12-29-2010, 03:08 PM
  5. Time Stamp Removal/deletion?
    By thorsonb in forum Access
    Replies: 3
    Last Post: 03-30-2010, 10:17 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