嗨,我是zend framework的新手
这是我的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')
);
答案 0 :(得分:0)
您可以使用Zend_Db_Expr Adding Expression Columns实现此目的。
在您的查询中,选择查询将是
$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);