Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Non-Exact match Lookup Table

Posted on 2008-10-13
4
Medium Priority
?
330 Views
Last Modified: 2013-11-27
I want to update table1.Code with table2.Code by matching the value of table1.Description to the data in table2.MatchingText where the two are not exact matches (eg. table1.Description LIKE table2.MatchingText), essentially a non-exact match lookup table.

Tables are structured as:

table1
-------
recNum
Description
Code

table2
-------
MatchingText
Code

It seems like it should be easy, but I'm at a loss.
0
Comment
Question by:LERNWebmaster
  • 2
  • 2
4 Comments
 
LVL 60

Expert Comment

by:Kevin Cross
ID: 22708218
You are pretty close, but since you don't have an exact match you have to do something like this:

table1.Description LIKE "*" & table2.MatchingText & "*"
0
 

Author Comment

by:LERNWebmaster
ID: 22708232
and how would I link those?
0
 
LVL 60

Accepted Solution

by:
Kevin Cross earned 1000 total points
ID: 22708242

UPDATE Table1 t1 INNER JOIN Table2 t2
ON t1.Description LIKE "*" & t2.MatchingText & "*"
SET t1.Code = t2.Code

Open in new window

0
 

Author Closing Comment

by:LERNWebmaster
ID: 31505760
Thanks.  I'm going to go smack myself for being so lame now. :-)
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Suggested Courses

877 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