Results 1 to 3 of 3
  1. #1
    rachmorr9 is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Posts
    1

    Query to find Partial Match of Column Data

    I have a table that I am trying to run a query on to pull records that contain duplicate data.
    For example:



    Wholesaler_Drug_ID = 123456
    Wholesaler_Drug_ID = 123456INNER

    I want my query to match the first 6 characters (without defining what they are since they will all be different) and wildcard anything that follows (which in this case is the word INNER).

    Please let me know if more details about the query are needed in order to understand my request.

  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
    In query design, put under Criteria

    Code:
    like [enter six digits] & "*"
    You get an inputbox that asks you to input six digits and will wildcard everything behind it

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,633
    Something like:

    SELECT Left([Wholesaler_Drug_ID,6) AS ShortID, Count(*) AS CountDups GROUP BY Left([Wholesaler_Drug_ID,6);

    The count will tell you which ID have 'duplicates'.

    Then try:

    SELECT table.*, Q.* FROM table INNER JOIN (SELECT Left([Wholesaler_Drug_ID,6) AS ShortID, Count(*) AS CountDups GROUP BY Left([Wholesaler_Drug_ID,6)) AS Q ON table.Left([Wholesaler_Drug_ID,6)=Q.ShortID WHERE CountDups > 1;

    Or try:

    SELECT * FROM table WHERE DCount("*", "table", "Left([Wholesaler_Drug_ID,6)='" & Left([Wholesaler_Drug_ID,6) & "'")>1;
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 2
    Last Post: 07-27-2015, 06:53 AM
  2. Partial Match Query
    By punna111 in forum Queries
    Replies: 10
    Last Post: 08-20-2014, 03:35 PM
  3. Replies: 11
    Last Post: 02-06-2014, 10:05 PM
  4. Replies: 4
    Last Post: 02-06-2014, 03:35 PM
  5. Find an Exact Match in a Access Table column
    By raghavendran in forum Access
    Replies: 4
    Last Post: 10-12-2013, 11:57 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