Results 1 to 5 of 5
  1. #1
    Join Date
    Nov 2002
    Location
    Oakland, CA
    Posts
    126

    Unanswered: OUTSIDE JOIN??? Non-matching items query

    Simple situation. I have two tables (tblA and tblB), each of them has 1 field called Nr.

    TblA has records 1, 2, 3
    TblB has records 1, 2, 3, 4

    It's easy to build a query that results in matching items from both tables (i.e. 1, 2, 3). BUT, how do I build the query to display only non-matching items in TblB? (e.i. 4).

    Can't figure it out. Of course my real time situation is that I'm trying to get a list of all records that are present in one table but are not in the other one. THANK YOU

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    select Nr
    from TblB
    left outer
    join TblA
    on TblB.Nr = TblA.Nr
    where TblA.Nr is null
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Mar 2010
    Posts
    18
    Thanks r937.
    It worked for me too..

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by andy982183 View Post
    Thanks r937.
    It worked for me too..
    andy, this thread is seven years old!!!

    i see you've given up on devshed and now you're asking your mixed case questions over here
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    of course you could 'just' use the find unmatched query wizard in Access
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •