SQL Fuzzy Join - MSSQL
<p>I have two sets of data. Existing customers and potential customers. </p>

<p>My main objective is to figure out if any of the potential customers are already existing customers. However, the naming conventions of customers across data sets are inconsistent. </p>

<p><strong>EXISTING CUSTOMERS</strong></p>

<pre><code>Customer /  ID
Ed's Barbershop /   1002
GroceryTown /   1003
Candy Place /   1004
Handy Man / 1005
</code></pre>

<p><strong>POTENTIAL CUSTOMERS</strong></p>

<pre><code>Customer
Eds Barbershop
Grocery Town
Candy Place
Handee Man
Beauty Salon
The Apple Farm
Igloo Ice Cream
Ride-a-Long Bikes
</code></pre>

<p>I would like to write some type of select statement like below to reach my objective:</p>

<pre><code>SELECT a.Customer, b.ID
FROM PotentialCustomers a LEFT JOIN
     ExistingCustomers B
     ON a.Customer = b.Customer
</code></pre>

<p>The results would look something like:</p>

<pre><code>Customer /  ID
Eds Barbershop  / 1002
Grocery Town    / 1003
Candy Place / 1004
Handee Man  / 1005
Beauty Salon /  NULL
The Apple Farm /    NULL
Igloo Ice Cream / NULL
Ride-a-Long Bikes / NULL
</code></pre>

<p>I am vaguely familiar with the concepts of Levenshtein Distance and Double Metaphone but I am not sure how to apply it here. </p>

<p>Ideally I would want the JOIN portion of the SELECT statement to read something like: <code>LEFT JOIN ExistingCustomers as B WHERE a.Customer LIKE b.Customer</code> but I know that syntax is incorrect.</p>

<p>Any suggestions are welcomed. Thank you!</p>