gpt4 book ai didi

php - mySQL WHERE 语句中的多重 AND 比较

转载 作者:太空宇宙 更新时间:2023-11-03 11:39:22 24 4
gpt4 key购买 nike

我有以下不正确的 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;

关于php - mySQL WHERE 语句中的多重 AND 比较,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43209309/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com