By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,916 Members | 1,068 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,916 IT Pros & Developers. It's quick & easy.

Is it possible to conduct LIKE inner joins?

P: 1
Hi

I was wondering if it was possible to conduct a "Like" join between two tables based on two text fields; so that i can get wildcard style results? Example: Table 1 Field 1: Record 1 = "ABC 123 DEF" which i would join using some sort of Like wildcard function to Table 2 Field 1: Record 1 = "ABC" ??

Thanks for any help
Oct 12 '07 #1
Share this Question
Share on Google+
1 Reply


FishVal
Expert 2.5K+
P: 2,653
Hi, there.

Yes this is possible. You may put to ON clause of table join almost any expression evaluating to boolean. The expression has to contain fields from both tables.

e.g.
Expand|Select|Wrap|Line Numbers
  1. SELECT Table1.*, Table2.*
  2. FROM Table1 INNER JOIN Table2 ON (Table1.fld1 Like '*' & Table2.fld1 & '*') OR (Table2.fld1 Like '*' & Table1.fld1 & '*');
  3.  
BTW VBA functions are allowed in join criteria too.
e.g.

Expand|Select|Wrap|Line Numbers
  1. SELECT Table1.*, Table2.*
  2. FROM Table1 INNER JOIN Table2 ON Len(Table1.fld1)>Table2.fld2;
  3.  
Oct 12 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.