i am working on a search system in which a person is searched by country and their firstname and the last name. For the First and Last name i used concatbut using it with further and condition doesn’t seems to work. my query is
select * from users_profile where CONCAT(fname,' ',lname) like '%v %'
or Email like '%v %' AND country='india'
in the above if ise use the query without “and” it works . but i need to specify more conditions and if i simply use and without concat that also works .
select * from users_profile where CONCAT(fname,' ',lname) like '%v %'
or Email like '%v %'
how to make it work with both concat and further and condition i want to apply.
You should not be using
CONCAT, let alone any functions around yourWHEREcolumns. Further, you should be specifying a column list, notSELECT *. Also check your order of criteria.You can try something like this: