2

嗨,我是 zend 框架的新手

这是我的 sql 查询

select * from cwi_company where manage=1 and deleteOption='0' and passwordStatus=1 and organizationuserid in (SELECT userId FROM cwi_passtable WHERE passwordAciveStatus ='1';

我想在 zend 模型中实现上述查询

例子:

$row = $select_company_table->fetchAll(
                                $select_company_table->select()
                                                    ->where('manage=1 and status=0')
                                                    ->order('id DESC')
                                );
4

1 回答 1

0

您可以使用 Zend_Db_Expr添加表达式列来实现它。

在您的查询中,选择查询将是

$select = $select_company_table->select()
                                ->where('manage=1 and status=0')
                                ->where ( 'organizationuserid IN ?' => new Zend_Db_Expr('SELECT userId FROM cwi_passtable WHERE passwordAciveStatus = 1'))
                                ->order('id DESC');

$row =  select_company_table->fetchAll($select);    
于 2013-05-20T12:10:58.330 回答