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;