我想在三個字段上搜索:id,name和address。我希望我的搜索有點聰明。在CONCAT中添加通配符在mysql中
用戶表
id | firstname | lastname | address
N29-0001 | John | Doe | California
N29-0002 | Jonathan | Morson | Miami
我的查詢到目前爲止
select subscriberid, CONCAT(firstname," ",lastname) as fullname, address, city from subscriber where id like "%N29 Joh%" or CONCAT(firstname," ",lastname) like "%N29 Joh%" or address like "%N29 Joh%" or city like "%N29 Joh%"
我想我的查詢搜索,如果我輸入N29荷蘭Joh,它將搜索李四。
我認爲你應該調查全文索引。 –