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

Query linked by cust name to find similar AND exact records

P: 2
I have two tables linked by customer name. I would like to know how to extract all records with the same or similar customer name. Thanks.
Aug 22 '08 #1
Share this Question
Share on Google+
3 Replies


FishVal
Expert 2.5K+
P: 2,653
I have two tables linked by customer name. I would like to know how to extract all records with the same or similar customer name. Thanks.
Hello, jadl.

By a simple word "similar" you've just made one step on the way which could lead to artificial intellect problem discussion.
Tell us please what do you actually mean by this word.
And for starters you may read this thread.

Kind regards,
Fish
Aug 22 '08 #2

P: 2
Thanks for the quick response. I read the thread you recommended, but here are examples of 'similar' cust names:
Advance Auto Parts
Advanced Auto parts
or
Ford Motor Company
Ford Motor Inc.

I was hoping there would be a conditional statement that tells Access to only look at say the first 7 letters of the cust name and extract all records where the first 7 letters match. I know this would not be the most accurate solution, but until we could get the data cleaned up, it would be better than nothing. Thanks again.



Hello, jadl.

By a simple word "similar" you've just made one step on the way which could lead to artificial intellect problem discussion.
Tell us please what do you actually mean by this word.
And for starters you may read this thread.

Kind regards,
Fish
Aug 22 '08 #3

FishVal
Expert 2.5K+
P: 2,653
Ok.

To start with a flexible solution I would recommend to implement comparisson logic in a VBA function. This VBA function will be further used in query to return critereion used in JOIN ... ON construction.

Below is a simple example of such.

Expand|Select|Wrap|Line Numbers
  1. Public Function CompareStrings(str1 As String, str2 As String) As Boolean
  2.     CompareStrings=(Left(str1, 7)=Left(str2, 7))
  3. End Function
  4.  
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM tbl1 INNER JOIN tbl2 ON CompareStrings(tbl1.[CustomerName], tbl2.[CustomerName]);
  2.  
Let me know how do you like the approach in general.

Regards,
Fish
Aug 24 '08 #4

Post your reply

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