繁体   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