October 1st, 2012, 03:30 PM
Select statement for similar name in another table...
I've got the following in the table scores:
id, name, score
In the table ftf I've got the following:
ID, Name, Level, Score
In table scores there is a value for the 'name' field of "Timothy John Mousel". In table 'ftf' there is a value for the 'Name' field of "Mousel,Timothy John".
How would I write a query to find a name in one table that matches the name in the other table.
The query below doesn't return the result but it's hopefully somewhat close to what I want to do.
UPDATE 'ftf' SET ftf.Score = scores.score WHERE ftf.Name LIKE '%name%'
Thanks in advance,
October 1st, 2012, 04:57 PM
In ftf are the names always formatted as last name, first name? You could then do
Originally Posted by Bigtime
UPDATE 'ftf' SET ftf.Score = scores.score WHERE ftf.Name LIKE '%last name%,%first name%'
"Those who can make you believe absurdities can make you commit atrocities."
October 1st, 2012, 05:21 PM
ON scores.name = CONCAT(SUBSTRING_INDEX(ftf.name,',',-1)
SET ftf.score = scores.score
October 2nd, 2012, 12:22 PM
In the scores table the data could be any of the following formats:
Timothy John Mousel
Tim John Mousel
Any ideas on how it could be accomplished using these possible formats?
October 2nd, 2012, 02:57 PM
clean up your data, and not with sql -- buy a professional name/address cleansing product