Results 1 to 3 of 3

Thread: Finding the excluded records in access

  1. #1

    Thread Starter
    Hyperactive Member Animelion's Avatar
    Join Date
    Jan 2001
    Location
    Jacksonville NC
    Posts
    283

    Finding the excluded records in access

    If I have

    tblOne with column [Social]
    with value 1,2,3,4,5,6,7,8,9,10

    and...

    tblTwo with column [social]
    with value 1,2,3,4,9,10,11,12,13,14

    How can I make a querie so that it looks at the two tables and returns the fields in tblOne that are not represented in tblTwo.

    giving me the results 5,6,7,8

    Many thanks to anyone who can help me get over this hurdle. ~Bryan
    ~ Animelion

  2. #2
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,024

    Re: Finding the excluded records in access

    Hi,


    Just use the concept of subquery....Here is the equivalent SQL Statement to retrieve your desired results..This sql statement works fine..Attach this in your query design view...Let me know...

    Select Social from tblOne where Social not in (Select Social from tblTwo);
    Greg

    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  3. #3
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    Re: Finding the excluded records in access

    OR you can use an OUTER JOIN statement and look for NULL values in the 2nd table.

    Code:
    SELECT	T1.social
    FROM	tblOne T1
    LEFT OUTER JOIN
    	tblTwo T2
    ON	T1.social = T2.social
    WHERE	T2.social IS NULL
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

Posting Permissions

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



Click Here to Expand Forum to Full Width