title: Fuzzy MySQL query using R
body: <p>I am using <code>RODBC</code> package for simple MYSQL query:</p>
  
  <pre><code>loadData_pd &lt;- function(namesurname) {
    lapply( dbListConnections( dbDriver( drv = "MySQL")), dbDisconnect)
    # Connect to the database
    db &lt;- dbConnect(MySQL(), dbname = 'database_name', host = options()$mysql$host, 
                    port = options()$mysql$port, user = options()$mysql$user, 
                    password = options()$mysql$password)
    # Construct the fetching query
      query &lt;- sprintf("SELECT * FROM pd_fizicke WHERE imeprezime = '%s'", 
                       namesurname)
    # Submit the fetch query and disconnect
    data &lt;- dbGetQuery(db, query)
    dbDisconnect(db)
    data
  }
  </code></pre>
  
  <p>I would like to change query to include fuzzy search. More concretely, it should return a row if there is a difference in one character ("John" and "Jehn" both include). So Levenstein distance should be one. Also I would like it returns the result if name and surname are in different order ("John Williams" and "Williams John" are both ok). How should I change my query to get above result?</p>