I have a textfield which takes in full name example: michael peter johnson
in my table i have three columns firstName , middlename and lastname
I have written this query but it returns empty
SELECT firstName,middleName,lastName
FROM staff
WHERE firstName LIKE "%michael peter johnson%"
OR middleName LIKE "%michael peter johnson%"
OR lastName LIKE "%michael peter johnson%"
if a user types in son it should display michael peter johnson, since son is contained in johnson.
thanks
my table : firstName has (michael) middleName has (peter) lastName (johnson)
Best Answer
If I understand well, it currently works for parts of firstname/middlename/lastname, but not if you want to enter the full name.
To fix that, yOu can use concat, so it will always work: