Php Mysql select query not working -
the below query results in following error:
sqlstate[23000]: integrity constraint violation: 1052 column 'accountid' in clause ambiguous
$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()" minimize db overhead ->where('accountid in (?)', array_unique($parentids)) ->setintegritycheck(false);
i don't have other column join. supposed now?
accountid put finance_account.accountid or ac.accountid because query ambiguous on table at
$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()" minimize db overhead ->where('ac.accountid in (?)', array_unique($parentids)) ->setintegritycheck(false);
Comments
Post a Comment