Results 1 to 5 of 5
  1. #1
    fluffyvampirekitten is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    108

    Query help! With unmatch records

    I have trying to tackle this scenario for a few weeks already .

    I'm trying to find all the unmatch names in my Access Table.
    However , I came accross this kind of scenario

    Example :
    In my Access table :
    EXT_PAT_ID | NAME
    1 | Teddy Bear
    1 | Ted
    2 | Teddy Bear
    2 | Teddy Bear

    With the code below
    Code:
    [DuplicatesPRODeposUPDATEsap.PAT_NAME) In (SELECT [PAT_NAME] FROM [DuplicatesPRODeposUPDATEsap] As Tmp GROUP BY [PAT_NAME] HAVING Count(PAT_NAME)< 2
    My current result:
    EXT_PAT_ID | NAME
    1 | Ted


    What I wanted to achieve is..
    To check the ID( if id = id ) , then check if the names are not the same ( name IS NOT EQUAL name)
    Then this will be the result. eg.
    EXT_PAT_ID | NAME
    1 | Teddy Bear
    1 | Ted





    Is there other way to achieve this ?
    Or what's wrong with my query.
    Please Help.
    Thanks





    Below here is my current code
    Code:
    SELECT DuplicatesPRODeposUPDATEsap.ID, DuplicatesPRODeposUPDATEsap.EXT_PAT_ID, DuplicatesPRODeposUPDATEsap.PAT_NAME, DuplicatesPRODeposUPDATEsap.GENDER, DuplicatesPRODeposUPDATEsap.DOB, DuplicatesPRODeposUPDATEsap.CREATE_DATE, DuplicatesPRODeposUPDATEsap.LAST_UPDATE_DATE, DuplicatesPRODeposUPDATEsap.C_SOURCE, DuplicatesPRODeposUPDATEsap.CAT_TYPE
    FROM DuplicatesPRODeposUPDATEsap
    WHERE (((DuplicatesPRODeposUPDATEsap.PAT_NAME) In (SELECT [PAT_NAME] FROM [DuplicatesPRODeposUPDATEsap] As Tmp GROUP BY [PAT_NAME] HAVING Count(PAT_NAME)< 2 )))
    ORDER BY DuplicatesPRODeposUPDATEsap.EXT_PAT_ID;

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    Its not clear what you are doing. In general the No Match is a compare between 2 separate tables. Your post seems to indicate a compare within 1 table involving multiple records/fields. If my interpretation is correct, and I'm not sure that it is - then you need to use a union query to temporarily create a single field i.e.
    1 [Teddy Bear Ted]
    2[ Teddy Bear Teddy Bear]

    and then set up a No Match on the new field you created. a 2 step process.

  3. #3
    JamesDeckert is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    Can you do this
    HAVING Count(ID & PAT_NAME)< 2

  4. #4
    fluffyvampirekitten is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jun 2015
    Posts
    108
    Quote Originally Posted by JamesDeckert View Post
    Can you do this
    HAVING Count(ID & PAT_NAME)< 2
    It works ! Thanks a lot . I don't know that I can do this .

  5. #5
    JamesDeckert is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    Salina, KS
    Posts
    262
    Quote Originally Posted by fluffyvampirekitten View Post
    It works ! Thanks a lot . I don't know that I can do this .
    I've never done it before, but it seemed reasonable. I tried it here and didn't get an error.

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

Similar Threads

  1. Unmatch query of sorts
    By buckmurdock in forum Queries
    Replies: 5
    Last Post: 07-06-2015, 07:08 PM
  2. Query to find unmatch data between two tables
    By MTSPEER in forum Queries
    Replies: 10
    Last Post: 01-29-2015, 10:48 AM
  3. Unmatch Query
    By NOEL71 in forum Queries
    Replies: 1
    Last Post: 06-18-2014, 06:55 AM
  4. Replies: 2
    Last Post: 08-10-2013, 06:06 PM
  5. Match/Unmatch Query need
    By kwooten in forum Queries
    Replies: 5
    Last Post: 11-08-2012, 01: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