如何基于ZF在SocialEngine中连接两个表

时间:2017-02-19 07:33:26

标签: php join zend-framework socialengine

我在SocialEngine中的代码是:

$coreLikesTable = Engine_Api::_()->getDbTable('likes', 'core');
$coreLikesTableName = $coreLikesTable->info('name');

$select = $usersTable->select()->from(array('l' => 'engine4_core_likes'), array('poster_id'))->join(array('u' => 'engine4_users'), 'l.poster_id = u.user_id')->group('u.user_id');

result = $coreLikesTable->fetchAll($select);
print_r($result);die;

但它没有输出任何东西。有什么问题?

由于

1 个答案:

答案 0 :(得分:0)

试试这个:

$select = $this->_db->select()
    ->from('table1',array('col1','col2'…..))
    ->joinInner('table2','table1.id=table2.some_id',array('col1','col3'…))
    ->where('where condition here')
    ->order('column name ASC/DESC');