簡體   English   中英

PHP MySQL選擇查詢不起作用

[英]Php Mysql select query not working

以下查詢導致以下錯誤:

SQLSTATE [23000]:違反完整性約束:1052 where子句不明確的列“ AccountId”

$select = $this->select()
            ->from(array('finance_account' => DB_TABLE_PREFIX . 'finance_account'), array(
                    'AccountId',
                    'ParentAccountId',
                    'AccountGroupId',
                    'AccountPath',
                    'AccountCode',
                    'AccountName',
                    'Description'
                ))
            ->joinLeft(array('ac' => DB_TABLE_PREFIX . 'customer'), 'finance_account.AccountId = ac.AccountId', array())
                    // using "array_unique()" to minimize db overhead
             ->where('AccountId IN (?)', array_unique($parentIds))
            ->setIntegrityCheck(false);

我沒有其他專欄可以做聯接。 我現在該怎么辦?

AccountId之類的字詞是finance_account.AccountId或ac.AccountId,因為查詢在要查看的表上含糊不清

$ select = $ this-> select()-> from(array('finance_account'=> DB_TABLE_PREFIX。'finance_account'),array('AccountId','ParentAccountId','AccountGroupId','AccountPath','AccountCode', 'AccountName','Description'))-> joinLeft(array('ac'=> DB_TABLE_PREFIX。'customer'),'finance_account.AccountId = ac.AccountId',array())//使用“ array_unique()”最小化數據庫開銷-> where('ac.AccountId IN(?)',array_unique($ parentIds))-> setIntegrityCheck(false);

暫無
暫無

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

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