我有一个select查询,试图在其中搜索多个模式的字符串
LIKE ('%this%' or '%that%' ) and something=else
返回零结果
然而
LIKE '%this%' and something=else
返回结果
LIKE '%that%' and something=else
返回结果
能把我所有的结果都放到一个查询中吗?如果字符串两者都匹配,它将如何处理?
我有一个select查询,试图在其中搜索多个模式的字符串
LIKE ('%this%' or '%that%' ) and something=else
返回零结果
然而
LIKE '%this%' and something=else
返回结果
LIKE '%that%' and something=else
返回结果
能把我所有的结果都放到一个查询中吗?如果字符串两者都匹配,它将如何处理?
如果可以,那就太好了,但不能在SQL中使用这种语法.
试试这个:
(column1 LIKE '%this%' OR column1 LIKE '%that%') AND something = else
注意括号的使用!你需要OR
个左右的表情