Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6013523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:33:42+00:00 2026-05-23T02:33:42+00:00

Using MS Access 2010, I have two tables where I want to find the

  • 0

Using MS Access 2010, I have two tables where I want to find the matching records in one of them by comparing similar fields (1:1 and 1:M).

Table 1, [760Vadim] has four fields: Folio, PID Number1, PID Number2, PID Number3

Table 2, [no_dupes] has two fields: Folio, PID

I need to find all records in [760Vadim] that have a matching value from the similar fields in [no_dupes].

Comparing Folio fields is a 1:1 join whereas comparing the PIDs is 1:M (1:3) and they both need to be compared at the same time!

I have tried this using a Join and the following SQL statements:

1.) Works, but only for one field at a time!

SELECT [760Vadim].*, no_dupes.PID
FROM no_dupes INNER JOIN 760Vadim ON no_dupes.PID = [760Vadim].[PID Number1]
WHERE (((no_dupes.PID) Like [760Vadim].[PID Number1]));

2.) Does not work when comparing PID to two fields, 0 records returned…!

SELECT [760Vadim].*, no_dupes.PID
FROM no_dupes INNER JOIN 760Vadim ON (no_dupes.PID = [760Vadim].[PID Number2]) AND (no_dupes.PID = [760Vadim].[PID Number1])
WHERE (((no_dupes.PID) Like [760Vadim].[PID Number1])) OR (((no_dupes.PID) Like [760Vadim].[PID Number2]));

3.) This kind of works… but returns duplicates… and going back into design view, it says invalid operator due to changing AND to OR, so it doesn’t like my = sign?

SELECT [760Vadim].*, no_dupes.PID
FROM no_dupes INNER JOIN 760Vadim ON (no_dupes.PID = [760Vadim].[PID Number2]) OR (no_dupes.PID = [760Vadim].[PID Number1])
WHERE (((no_dupes.PID) Like [760Vadim].[PID Number1])) OR (((no_dupes.PID) Like [760Vadim].[PID Number2]));

Also tried another forums suggestions:
1.) Works (i think…), but duplicates again!

SELECT [760Vadim].*
FROM 760Vadim, no_dupes
WHERE ((([760Vadim].folio)=[no_dupes].[DATA_SO1])) OR ((([760Vadim].[PID Number1])=[no_dupes].[PID])) OR ((([760Vadim].[PID Number2])=[no_dupes].[PID])) OR ((([760Vadim].[PID Number3])=[no_dupes].[PID]));

It seems to go through and return a record if a match is found for folio, AND returns another record (could be a duplicate) if a matching PID is found from the three other fields.

From a similar question it is suggested to use the CONCAT feature inside of the Join to remove the duplicates.

I also tried adding: GROUP BY [760Vadim].*; after the where statement to remove duplicates but no avail, it says cannot group ALL records, which is what I need. I am new to Access but have some familiarity with SQL (basics).

Apologies if posted in wrong stack, it may sit better in Programmers or Database stackexchange?

EDIT:
I tried the option without the Join as:

SELECT DISTINCT v.*
FROM   [760Vadim] v 
WHERE
      EXISTS(SELECT * FROM  no_dupes nd 
         WHERE nd.pid LIKE v.[PID Number1] 
             OR nd.pid LIKE v.[PID Number2] 
             OR nd.pid LIKE v.[PID Number3]
             OR nd.folio LIKE v.[folio] )

The option you provided only returns the four columns from the 760Vadim table, it’s preferred to see ALL of them.
I also noticed it didn’t compare the folio fields (that specification is lost in my ramble, sorry).

Did I format it correctly to SELECT DISTINCT all columns in 760Vadim IF a match is found in no_dupes?

When I go back into SQL/design view, it throws an exception error and changes the SQL to:

SELECT DISTINCT v.* INTO query_final
FROM 760Vadim AS v
WHERE (((Exists (SELECT * FROM  no_dupes nd 
         WHERE nd.pid LIKE v.[PID Number1] 
             OR nd.pid LIKE v.[PID Number2] 
             OR nd.pid LIKE v.[PID Number3]
             OR nd.folio LIKE v.[folio] ))<>False));
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:33:42+00:00Added an answer on May 23, 2026 at 2:33 am

    You have a couple options

    Using DISTINCT/JOIN

    SELECT DISTINCT v.folio, 
                    v.[PID Number1], 
                    v.[PID Number2], 
                    v.[PID Number3] 
    FROM   [760Vadim] v 
           INNER JOIN no_dupes nd 
             ON nd.pid LIKE v.[PID Number1] 
                 OR nd.pid LIKE v.[PID Number2] 
                 OR nd.pid LIKE v.[PID Number3] 
    

    USING DISTINCT/EXISTS

    SELECT DISTINCT 
           v.folio, 
           v.[PID Number1], 
           v.[PID Number2], 
           v.[PID Number3] 
    FROM   [760Vadim] v 
    WHERE
          EXISTS(SELECT * FROM  no_dupes nd 
             WHERE nd.pid LIKE v.[PID Number1] 
                 OR nd.pid LIKE v.[PID Number2] 
                 OR nd.pid LIKE v.[PID Number3] )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Access 2010. Suppose I have three tables: dogs , cats , and catChases
I have two tables in an MS Access 2010 database: TBLIndividuals and TblIndividualsUpdates. They
Using Access 2003 I want to get a table value from the two databases
I have a problem with Access 2010. I'm using the included datepicker with the
I am using VB.net 2010 and I have two projects: SQLtesting and Controls .
Using VBA with Access 2010, I have a sub: Public Sub setInterest(account As String,
Using Access 2003 In my table column, some of the fields are null, some
We have an ADP project created several years ago using Access 2000. This project
I have the following problem in a Database using Access 2007 as front end
We are planning to create two sharepoint web applications using SharePoint 2010 Enterprise Edition.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.