Home > Software engineering >  Check value between two tables (MS ACCESS)
Check value between two tables (MS ACCESS)

Time:11-21

I have two table:

table1: colName

values: Ford, Audi, Opel

table2: colNewName

values: 87 Ford Carl, one9 Audi, _12br Opel 45X

How to write query, to check if values from table1 exist into table2?

expect Result:

table1  table2            Result
Ford    "87 Ford Car"     True
Audi    "one9 Audi"       True
Opel    "_12br Opel 45X"  True

CodePudding user response:

A simple select query will do:

SELECT 
    table1.colName, 
    table2.colNewName, 
    table2.colNewName Is Not Null As Result
FROM 
    table1 
LEFT JOIN 
    table2 
    ON table2.colNewName Like "*" & table1.colName & "*"
  • Related