简体   繁体   中英

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

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

$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

$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时,它不返回任何内容,因为代码是最新且正确的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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