gpt4 book ai didi

PHP MySQL 查询忽略 AND 语句

转载 作者:行者123 更新时间:2023-11-29 05:25:38 25 4
gpt4 key购买 nike

我有以下 PHP 查询,它执行 MySQL 查询时没有错误,但最后忽略了查询的城市部分?有什么方法可以安排 AND/OR 语句吗?

$sql_query = "SELECT ListOfficeMLSID AS list_office_mlsid, MLSNumber AS mls_number, City AS city, ListPrice AS list_price FROM my_table WHERE ListOfficeMLSID =\"office6\" OR ListOfficeMLSID =\"office7\" OR ListOfficeMLSID =\"office2\" AND ListPrice >= 1500000 AND city = \"Bonita Springs\" OR city = \"Estero\"";

最佳答案

$sql_query = "SELECT ListOfficeMLSID AS list_office_mlsid, MLSNumber AS mls_number, City AS city, ListPrice AS list_price FROM my_table WHERE ListOfficeMLSID IN('office6','office7','office2') AND ListPrice >= 1500000 AND city IN('Bonita Springs', 'Estero')";

关于PHP MySQL 查询忽略 AND 语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20688786/

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