Results 1 to 5 of 5
  1. #1
    DB2010MN26 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    37

    Exclude values that appear in a certain table


    I have two tables I'm quering from. I want to exclude a certain value that appears in one table, while including it if it appears in another. Essentially if the value appears in both tables, I do not want it included, how would I accomplish this?

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    exclude: table1
    including: table2

    select table2.* from table2 left join table1 on table1.key=table2.key where table1.key is null

  3. #3
    DB2010MN26 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    37
    I'm sorry but I don't understand. I joined the two tables but all that seams to do is show the records that exist on both. I want to do the opposite.

  4. #4
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    select table2.* from table2 left join table1 on table1.key=table2.key where table1.key is null

    will show records in table2 but not in table1.

  5. #5
    DB2010MN26 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    37
    Got it working, Thanks!

    On a side note, is it just me or is the join properties box in access mis-leading when it describes option 2 (left join).

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

Similar Threads

  1. Replies: 2
    Last Post: 08-22-2010, 01:42 PM
  2. Exclude rows to get to data/field names
    By The Stig in forum Access
    Replies: 1
    Last Post: 06-27-2010, 09:36 PM
  3. Get values from another table (ID)
    By Dega in forum Programming
    Replies: 3
    Last Post: 05-16-2010, 06:28 PM
  4. Exclude records within same criteria
    By brooke48 in forum Queries
    Replies: 14
    Last Post: 05-15-2010, 02:15 PM
  5. Replies: 3
    Last Post: 04-04-2010, 05:26 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