我需要选择仅选择abv =“yes”和其他过滤器,例如:
SELECT *
FROM `business`
WHERE `category` LIKE ('$_GET[search]%')
OR `location` LIKE ('$_GET[search]%')
OR `name` LIKE ('$_GET[search]%')
OR `address` LIKE ('$_GET[search]%')
AND `apv`='yes'
这不起作用,如果我把它全部并且不返回任何东西,另一方面如果我把OR返回包括apv与“是”不同
我需要选择它:
SELECT *
FROM `business`
WHERE `category` LIKE ('$_GET[search]%')
OR `location` LIKE ('$_GET[search]%')
OR `name` LIKE ('$_GET[search]%')
OR `address` LIKE ('$_GET[search]%')
但只有apv =“是”
答案 0 :(得分:2)
尝试
SELECT *
FROM `business`
WHERE (
`category` LIKE ('$_GET[search]%')
OR `location` LIKE ('$_GET[search]%')
OR `name` LIKE ('$_GET[search]%')
OR `address` LIKE ('$_GET[search]%')
)
AND `apv`='yes'
答案 1 :(得分:2)
您是否尝试过围绕这些条款?
SELECT *
FROM `business`
WHERE (
`category` LIKE ('$_GET[search]%')
OR `location` LIKE ('$_GET[search]%')
OR `name` LIKE ('$_GET[search]%')
OR `address` LIKE ('$_GET[search]%')
)
AND `apv`='yes'