简体   繁体   English

当我使用“ NOT IN”查询SQL时,PHP函数未从SQL返回结果

[英]php function not return result from sql when I user sql with 'NOT IN' to query

I use sql command to select data from oracle server and got result like this 我使用sql命令从oracle服务器中选择数据,并得到了这样的结果

select *
  from login_log
  where userid not in (select userid
                         from last_log
                         where userid is not null) and
        LOGIN_ID='423'

but when I use this sql in php function it's not return anything 但是当我在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);

I don't know why I didn't get result with "NOT IN" I try to test the code by change "NOT IN" to "IN" like this 我不知道为什么我没有得到“ 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'";

And it's return result normally, I don't know what happen with. 它通常是返回结果,我不知道会发生什么。 Can any body help me please. 有没有人可以帮助我。

我会说这是因为ID 423在其中,而当您的查询要求不输入ID时,它不返回任何内容,因为代码是最新且正确的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM