时间:2021-07-01 10:21:17 帮助过:27人阅读
WHERE `status` = '已完成'
AND `type` = ''
AND `phone` LIKE '%{$user}%'
OR `phone2` LIKE '%{$user}%'
OR `address` LIKE '%{$user}%'
OR `name` LIKE '%{$user}%'
OR `email` LIKE '%{$user}%'
ORDER BY `buytime` DESC
條件是"status一定要是已完成 然後type一定要是空"
然後其他任一個有符合的都可以
我這樣子做會變成status不是已完成 type不是空的也會被搜索出來
想請問一下該怎麼下where條件
WHERE `status` = '已完成'
AND `type` = ''
AND `phone` LIKE '%{$user}%'
OR `phone2` LIKE '%{$user}%'
OR `address` LIKE '%{$user}%'
OR `name` LIKE '%{$user}%'
OR `email` LIKE '%{$user}%'
ORDER BY `buytime` DESC
條件是"status一定要是已完成 然後type一定要是空"
然後其他任一個有符合的都可以
我這樣子做會變成status不是已完成 type不是空的也會被搜索出來
WHERE `status` = '已完成'
AND `type` = ''
and (
`phone` LIKE '%{$user}%'
or`phone2` LIKE '%{$user}%'
OR `address` LIKE '%{$user}%'
OR `name` LIKE '%{$user}%'
OR `email` LIKE '%{$user}%'
)
ORDER BY `buytime` DESC