Saturday, 24 August 2013

Mysql: search fullname in a splitted name table

Mysql: search fullname in a splitted name table

I am looking for a method that you can look for a full name in a splitted
collumn table
I tried: for example with "michael peter johnson"
select firstName,middleName,lastName
from staff
where concat(firstName, ' ', middlename, ' ', lastname) Like "%michael
peter johnson%"
that works but if the name is "michael johnson" it does not work cause the
concat name created: "michael (double space)johnson" So the concat creates
two spaces and that does not match.
Does anyone know an alternative way to have a solution for this?
Thx Matthy

No comments:

Post a Comment