Using mysql concat() in WHERE clause?

后端 未结 7 2014
旧巷少年郎
旧巷少年郎 2020-11-29 00:59

I would like to search my table having a column of first names and a column of last names. I currently accept a search term from a field and compare it against both columns

7条回答
  •  眼角桃花
    2020-11-29 01:37

    You can try this:

    select * FROM table where (concat(first_name, ' ', last_name)) = $search_term;
    

提交回复
热议问题