【问题标题】:How to join two tables in SocialEngine, based on ZF如何在 SocialEngine 中加入两个表,基于 ZF
【发布时间】:2017-02-19 07:33:26
【问题描述】:

我在 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;

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

谢谢

【问题讨论】:

    标签: php join zend-framework socialengine


    【解决方案1】:

    试试这个:

    $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');
    

    【讨论】:

      猜你喜欢
      • 2023-03-15
      • 2020-07-26
      • 1970-01-01
      • 2018-12-17
      • 2015-04-28
      • 2021-07-23
      • 1970-01-01
      • 2019-01-26
      • 2021-06-25
      相关资源
      最近更新 更多