我有以下不正确的 mySQL 语句。
SELECT id, location__, image__, bedrooms, bathrooms, price__
FROM myTable
WHERE LOWER(location__) REGEXP '.london.'
AND (bedrooms >=2)
AND (bathrooms == true)
ORDER BY price__ DESC
LIMIT 0,20;
如何格式化在 PHP 中运行的 SQL 查询,以便我可以比较卧室 > 2 AND 浴室 > 2 AND ensuites = 1(即 true)...等
您只需使用 AND 添加您喜欢的条件即可满足您的要求。
SELECT id, location__, image__, bedrooms, bathrooms, price__
FROM myTable
WHERE LOWER(location__) REGEXP '.london.'
AND bedrooms >=2
AND bathrooms >=2 and ensuites = 1
ORDER BY price__ DESC
LIMIT 0,20;
我是一名优秀的程序员,十分优秀!