我有 3 列感兴趣:RateName
并且URL
是 varchars,MaxNum
是 INT。当我尝试执行以下命令时,它失败了:
SELECT * FROM `table1` WHERE `RateName` LIKE '%$customerType%'" AND `URL` IS NOT NULL AND `MaxNum` = 2
错误是:#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '" AND URL IS NOT NULL AND MaxNumOfTiers = 2' at line 1
我尝试将查询分开,以下代码可以正常工作:
SELECT * FROM `table1` WHERE `RateName` LIKE '%$customerType%'"
但是,当我添加其他AND
条件时,我得到了错误。