Query Builder (SQL View) - Like Command

  • Thread starter Thread starter warrenk
  • Start date Start date
W

warrenk

I am trying to join 2 tables. I want to join if 'Field B' is in 'Field A'.

ie.
Field A = 'ABCDE'
Field B= 'BC'
....the join would be successful cause 'BC' is in 'ABCDE'. Is this possible?


I tried...
SELECT FROM table1 INNER JOIN table2 ON table1.name like (% table2.
partial_name %);

Keep getting errors.

Any help greatly appreciated!
Warren
 
You can modify SQL join like you are trying but it will give a warning that
it cannot display it in design view.
Rather than trying to join then why not use criteria instead.
Like "*" & [Field B] & "*"
 
A slightly different join syntax may help:

SELECT table1.*, table2.*
FROM table1, table2
WHERE table1.name LIKE "*" & [table2].[partial_name] & "*") ;
 
Depending on the "flavor" of SQL you are using

SELECT *
FROM table1 INNER JOIN table2
ON table1.name like '%' & table2.partial_name & '%'

Or

SELECT *
FROM table1 INNER JOIN table2
ON table1.name like "*" & table2.partial_name & "*"

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
Back
Top