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

    SQL QUERY - Duplicate

    My current code is to extract all those data with duplicate /same name , dob , gender and postal code .



    Code:
    SELECT *
    FROM CrossSystemData
    WHERE (((CrossSystemData.C_SOURCE)
    IN 
    ( SELECT [C_SOURCE] FROM [CrossSystemData] As tmp
    GROUP BY [C_SOURCE] , [POSTAL_CODE] , [DOB] , [NAME] , [GENDER] HAVING COUNT(*) > 1 AND 
    [POSTAL_CODE] = [CrossSystemData].[POSTAL_CODE] AND [DOB] = [CrossSystemData].[DOB] AND
    [NAME] = [CrossSystemData].[NAME] AND [GENDER] = [CrossSystemData].[GENDER]) AND
    (CrossSystemData.C_SOURCE)=("EPOS")))
    ORDER BY CrossSystemData.C_SOURCE, CrossSystemData.POSTAL_CODE, CrossSystemData.DOB, CrossSystemData.GENDER, CrossSystemData.NAME;
    I need to compare the data in the row against the data in the other row, and I'd like to use LIKE to compare the name
    I would like to extract those date with same dob , gender and postal code but the with similar ( alike) . However , I have no idea how to do it .


    Code:
    SELECT *
    FROM CrossSystemData
    WHERE (((CrossSystemData.C_SOURCE)
    IN 
    ( SELECT [C_SOURCE] FROM [CrossSystemData] As tmp
    GROUP BY [C_SOURCE] , [POSTAL_CODE] , [DOB] , [NAME] , [GENDER] HAVING COUNT(*) > 1 AND 
    [POSTAL_CODE] = [CrossSystemData].[POSTAL_CODE] AND [DOB] = [CrossSystemData].[DOB] AND [GENDER] = [CrossSystemData].[GENDER]) AND
    (CrossSystemData.C_SOURCE)=("EPOS"))) AND (CrossSystemData.CATEGORY)=("POTENTIAL DUP")
    AND [NAME] LIKE " % [CrossSystemData].[NAME] % "
    ORDER BY CrossSystemData.C_SOURCE, CrossSystemData.POSTAL_CODE, CrossSystemData.DOB, CrossSystemData.GENDER, CrossSystemData.NAME;

    Trying to do the code above but I did not get any results.
    Last edited by fluffyvampirekitten; 01-19-2016 at 09:47 PM. Reason: add in test(like) code

  2. #2
    JeroenMioch's Avatar
    JeroenMioch is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Location
    Den Haag, Netherlands
    Posts
    368
    Try the & symbol.
    I have a custom made filter on my form that has a like into it. Its no SQL but you can give it a go i guess.
    like '*" & [CrossSystemData].[Name] & "*'"

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

Similar Threads

  1. Duplicate Query
    By capjlp in forum Queries
    Replies: 4
    Last Post: 11-10-2014, 10:03 AM
  2. SUm duplicate values then delete duplicate rows
    By DonKaponne in forum Queries
    Replies: 1
    Last Post: 09-14-2014, 04:18 PM
  3. Replies: 3
    Last Post: 03-01-2013, 12:41 PM
  4. Query will duplicate records
    By funkygoorilla in forum Queries
    Replies: 3
    Last Post: 09-29-2011, 01:32 AM
  5. Duplicate query with a twist
    By coach32 in forum Queries
    Replies: 3
    Last Post: 09-20-2011, 06:57 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