簡體   English   中英

當我使用“ NOT IN”查詢SQL時,PHP函數未從SQL返回結果

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

我使用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'";

它通常是返回結果,我不知道會發生什么。 有沒有人可以幫助我。

我會說這是因為ID 423在其中,而當您的查詢要求不輸入ID時,它不返回任何內容,因為代碼是最新且正確的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM