Results 1 to 4 of 4
  1. #1
    Dog17 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    2

    Unmatched Query

    Good morning,

    I am trying to create a query to find unmatching data. I have data from two different systems I want to compare to find and show the differences.

    Example:

    System 1

    Dog Name.....State.....Status.....Owner.....Gender
    Charlie..........MA........Missing....Jacob......M
    Jack..............CA........Missing....Shane.....M
    Matt..............TX........Found......Adam......F
    Tom..............FL.........Found.....Ryan......M
    Victor............VA.........Found....John.......M

    System 2

    Dog Name.....State.....Status.....Owner.....Gender
    Charlie..........MA........Missing....Jacob......M
    Jack..............CA........Missing....Shane.....M
    Matt..............TX........Found......Adam......F
    Tom..............FL........ Missing...Ryan......M
    Victor............VA........Missing...John.......M

    Current SQL:

    SELECT [System 1].[Dog Name], [System 1].Status, [System 2].Status, [System 1].State, [System 2].State, [System 1].Gender, [System 2].Gender


    FROM [System 1] LEFT JOIN [System 2] ON ([System 1].Status = [System 2].Status) AND ([System 1].[Dog Name] = [System 2].[Dog Name])
    WHERE ((([System 2].[Dog Name]) Is Null));

    Current Query:

    Dog Name.....System 1.Status.....System 2.Status.....System 1.State.....System 2.State.....System 1.Gender.....System 2. Gender
    Tom..............Found............................ ...................FL............................. ......................M........................... .......................
    Victor............Found........................... ....................VA............................ .......................M.......................... ........................


    How do I get the query to display the data for system 2 aswell, like this:

    Dog Name.....System 1.Status.....System 2.Status.....System 1.State.....System 2.State.....System 1.Gender.....System 2. Gender
    Tom..............Found...................Missing.. ................FL.......................FL....... .................M..........................M..... ..................
    Victor............Found...................Missing. .................VA......................VA....... .................M..........................M..... ..................


    Thank you for any help!!

  2. #2
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    If the Dog Name is unique on both table, all you need to LEFT JOIN on the Dog Name and get your information on both table.

    If not, then you have to provide more information on table (Primary Key, Field Name, etc).

    If possible to post your database, it will be even easier.
    Last edited by lfpm062010; 08-07-2014 at 08:01 AM. Reason: Update

  3. #3
    Dog17 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2014
    Posts
    2
    The dog name is the primary key in both tables. Where do I LEFT JOIN?

    SELECT [System 1].[Dog Name], [System 2].[Dog Name], [System 1].Status, [System 2].Status, [System 1].State, [System 2].State, [System 1].Gender, [System 2].Gender
    FROM [System 1] LEFT JOIN [System 2] ON ([System 1].[Dog Name] = [System 2].[Dog Name]) AND ([System 1].Status = [System 2].Status)
    WHERE ((([System 2].[Dog Name]) Is Null));

  4. #4
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    Code not tested.

    SELECT [System 1].[Dog Name], [System 2].[Dog Name], [System 1].Status, [System 2].Status, [System 1].State, [System 2].State, [System 1].Gender, [System 2].Gender
    FROM [System 1] LEFT JOIN [System 2] ON ([System 1].[Dog Name] = [System 2].[Dog Name])
    ;

    This should give all record in table [System 1] and give NULL value for non matched in table [System 2].

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

Similar Threads

  1. Unmatched Addresses Query
    By #1Newbie in forum Queries
    Replies: 3
    Last Post: 06-03-2013, 06:54 AM
  2. Possible Complex Unmatched Query
    By millzerr in forum Queries
    Replies: 1
    Last Post: 12-10-2012, 04:00 PM
  3. Unmatched Query Qizard.
    By deepanadhi in forum Queries
    Replies: 7
    Last Post: 05-15-2012, 03:50 AM
  4. Replies: 1
    Last Post: 12-08-2011, 01:52 PM
  5. Unmatched query on 1 table
    By tmcrouse in forum Access
    Replies: 7
    Last Post: 06-01-2011, 08:38 AM

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