I'm looking for an SQL function that can get the 20 most similar results. If results are completely different I still want it to fetch 20 results starting with the most similar.
The LIKE parameter appears to be looking for matches that are too exacting to the current variable and at the moment in this example query is only fetching 2 results.
$sims = mysql_query("SELECT * FROM electors
WHERE constituency = '$constituency' AND ward = '$ward'
AND surname LIKE '$surname'");