title: using levenshtein distance ratio to compare 2 records
body: <p>I've created the mysql user function using the levenshtein distance and ratio source codes. I am comparing 2 records and based on a 75% match I want to select the record. </p>
  
  <ol>
  <li>Order comes into table <code>paypal_ipn_orders</code> with an <code>ITEM</code> title</li>
  <li>A query executes against a table <code>itemkey</code> to find a 75% match in a record called <code>ITEM</code> as well</li>
  <li>if a 75% title is match it assigns an eight digit number from table <code>itemkey</code> to table <code>paypal_ipn_orders</code></li>
  </ol>
  
  <p>Here is the query</p>
  
  <pre><code>      UPDATE paypal_ipn_orders
        SET sort_num = (SELECT sort_id
        FROM itemkey
        WHERE  levenshtein_ratio(itemkey.item, paypal_ipn_orders.item_name) &gt; 75)
        WHERE packing_slip_printed = 0 
        AND LOWER(payment_status) = 'completed' 
        AND address_name &lt;&gt; ''
        AND shipping &lt; 100
  </code></pre>
  
  <p>I have adjusted this a few times but it's failing between line 4 and 5 at the levenshtein_ratio part. If it works it says that the subquery returns more than one row. I don't know how to fix it to make it return the correct result, I just lost as to how to make this work. </p>