Compare two tables and find matching records in columns

Posted on 2011-11-01
Medium Priority
Last Modified: 2012-05-12
How do I compare two tables and find matching records in columns using SQL in access
Question by:StevenHook

Accepted Solution

VipulKadia earned 100 total points
ID: 37061561
You can use INNER JOIN to compare two table for matching records.

If you have 3 columns in two table to find matching records then you can write,
SELECT Table1.* FROM Table1 INNER JOIN Table2 ON Table1.Column1=Table2.Column1 AND Table1.Column2=Table2.Column2 AND Table1.Column3=Table2.Column3

If this query returns any result then you have those many matching records. Otherwise no matching records.

Assisted Solution

jdc1944 earned 100 total points
ID: 37061581
Comparing two columns

SELECT tbl1.field1, tbl2.field2
FROM tbl1 INNER JOIN tbl2 ON tbl1.field1 = tbl2.field2;

this will show only matches on the two columns (field1, filed2) from two tables (tbl1, tbl2)

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question