可能会考虑在这3列上创建全文索引,然后对其进行全文搜索。
http://dev.mysql.com/doc/refman/5.0/en/fulltext-natural-language.html
##更新##
如果使用innodb,那么可以使用php
split
字符串上的函数;
$myVars = split(" ",$user_keyword);
然后为每个单词添加一个select语句(我还将在select语句中使用concat,这样您就不必为每个where语句重复它)
$extraSQL = '';
foreach($myVars as $search) {
$extraSQL .= " AND `my_concat` LIKE '%".$search."%'";
}
SELECT
`your_fields`,
CONCAT_WS(' ', users.name_first, users.name_middle, users.name_last) as `my_concat`
FROM `your_tables`
WHERE `accounts_users`.account_ID = '$account_ID' . $extraSQL;