Compare 2 tables in access

December 2016


Compare 2 tables in access




Issue


I'm new to this forum and novice Access / SQL.

Let me explain my problem I have a database with 2 tables as follows:

Table1 Table2
Field1 Field1
registration1 registration1
Record2 Record2
enregistrement3 enregistrement3

The Field1 of Table1 contains a list and the product of Table2 Field1 contains a random list of keywords.

I would like (in Access) created a query so that it selects me and I see all the records of field1 (Table1) that contain a keyword of field1 (Table2).

Eg:

Table1 / Field1 contains "CremeSolaire", and table 2 / Field1 contains "Sun".

I therefore hope that Cremesolaire that contains "Sun" is selected and displayed in a report or a new table.

Help me please, I can not stop trying I fart a lead.

Solution


The easiest is to put ourselves in the basic pro download ...

Well, your query should include two tables, the "wild", since there is no join on a unique key. Therefore, I advise you to place the search field indexed (with or without duplication, for you to see).

You created a query, and you glue it in adapting SQL:

SELECT Table1.Champ1
FROM Table1, Table2
WHERE InStr (Table1.Champ1, Table2.Champ1)

Note


Solved by Pseudosaure

Related :

This document entitled « Compare 2 tables in access » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.