Of course in the real world I have hundreds of thousands of locations with several columns and I have millions of call records where I want to update the table and insert the "locations.name" into the location column of the calls table.
This code here does a nice job of finding the location that matches most closely.
//WORKING - one row at a time
SET @digits := "16125551212";
SELECT @digits, locations.name, FROM locations
WHERE locations.number_pattern in (
ORDER BY LENGTH(locations.number_pattern) DESC LIMIT 1
So where I'm lost is how to write my update query to ask SQL to loop over all the records WHERE call.location = 'NULL' and do my little query to update things.