php - 当我使用'NOT IN'使用sql进行查询时,php函数不会从sql返回结果
问题描述
我使用 sql 命令从 oracle 服务器中选择数据并得到这样的结果
select *
from login_log
where userid not in (select userid
from last_log
where userid is not null) and
LOGIN_ID='423'
但是当我在 php 函数中使用这个 sql 时它不会返回任何东西
$strSQL = "select * from login_log where userid not in (select userid from last_log where userid is not null) and LOGIN_ID='423'";
$objParse = oci_parse($objConnect, $strSQL);
oci_bind_by_name($objParse, ':sftp_id', $sftp_id);
oci_execute($objParse, OCI_DEFAULT);
$nrows = oci_fetch_all($objParse, $results, null, null, OCI_FETCHSTATEMENT_BY_ROW);
我不知道为什么我没有得到“NOT IN”的结果我尝试通过像这样将“NOT IN”更改为“IN”来测试代码
$strSQL = "select * from login_log where userid in (select userid from last_log where userid is not null) and LOGIN_ID='423'";
它是正常返回结果,我不知道发生了什么。任何机构都可以帮助我吗?
解决方案
我会说这是因为 id423
存在,当您的查询要求不存在时,它不会返回任何内容,因为代码是最新且正确的。
推荐阅读
- python - 每个实例的 Keras 自定义损失
- php - 在 PHP 中将表单数据作为表格格式的电子邮件发送
- c# - 获取映射的外键字段名,Entity Framework v6
- firebase - 我收到 Unhandled Promise Rejection 错误和一些数据结构建议
- javascript - 无法让 vanilla JS onreadystatechange 函数/readyState 4 工作
- linux - 如何将 .net 核心 Web API 作为 Linux 守护进程运行
- php - 将帖子中的自定义元框更改为页面
- python - Python 中的 Hot Deck 插补
- javascript - 通过将参数包装在函数中来延迟评估?
- dart - 将方法签名与模拟类中的未知参数匹配