In my SQL, I am using the WHERE
and LIKE
clauses to perform a search. However, I need to perform the search on a combined value of two columns - first_name
and last_name
:
WHERE customers.first_name + customers.last_name LIKE '%John Smith%'
This doesn't work, but I wondered how I could do something along these lines?
I have tried to do seperate the search by the two columns, like so:
WHERE customers.first_name LIKE '%John Smith%' OR customers.last_name LIKE '%John Smith%'
But obviously that will not work, because the search query is the combined value of these two columns.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…