0

如果我删除这个 var_dump 行,我的模块就会中断。为什么会这样。我的加入有什么问题吗

    protected function _prepareCollection() {

    $collection = mage::getModel('faq/faq')->getCollection();
    $collection->getSelect()->joinLeft(array('s'=>'gagan_faq_creation'),
            'main_table.faq_id = s.faq_id');
    var_dump($collection->getData());

    $this->setCollection($collection);
    parent::_prepareCollection();
}

我收到这个错误

QLSTATE[23000]: Integrity constraint violation: 1052 Column 'faq_id' in order clause is ambiguous
#0 C:\wamp\www\www.ubt.com\lib\Varien\Db\Statement\Pdo\Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 C:\wamp\www\www.ubt.com\lib\Zend\Db\Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 C:\wamp\www\www.ubt.com\lib\Zend\Db\Adapter\Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 C:\wamp\www\www.ubt.com\lib\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query('SELECT `main_ta...', Array)
#4 C:\wamp\www\www.ubt.com\lib\Varien\Db\Adapter\Pdo\Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('SELECT `main_ta...', Array)
4

1 回答 1

0

You are selecting faq_id from both table (main_table & gagan_faq_creation) that,s why it's giving MySQL error, So need to add alliance for gagan_faq_creation.faq_id.

于 2013-03-23T17:49:16.883 回答