我正在尝试创建搜索表单,并试图在多行/串联行中进行搜索。有没有办法使用类似以下代码的内容:
$where = "
WHERE
(
s.companyName,
s.companyName || s.companyType,
s.companyName || s.companyLocationType,
s.companyLocationName,
s.companyLocationName || s.companyLocationType
) LIKE (".$val.")
";
或:
$where = "
WHERE
(
s.companyName
OR s.companyName || s.companyType
OR s.companyName || s.companyLocationType
OR s.companyLocationName
OR s.companyLocationName || s.companyLocationType
) LIKE (".$val.")
";
还是我必须像那样使用它?
$where = "
WHERE
s.companyName LIKE (".$val.")
OR s.companyName || s.companyType LIKE (".$val.")
OR s.companyName || s.companyLocationType LIKE (".$val.")
OR s.companyLocationName LIKE (".$val.")
OR s.companyName || s.companyLocationType LIKE (".$val.")
";
答案 0 :(得分:0)
WHERE (".$val.") in (s.companyName | s.companyType,s.companyName | s.companyLocationType)
等如果您要查找完全匹配而不是使用LIKE,则可以使用。