関心のある 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
と、エラーが発生します。