0

我是zend框架的新手下面是我在zend模型中的sql查询

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

基本上它将获取表中的所有列。我只想选择 2 列,即 id 和 status,但我不知道语法。

4

1 回答 1

0

使用以下代码:

$select = $this->select()
               ->from(array('company_table'),array("id","status"))
                ->where('manage = ?','1') 
                ->where('deleteOption = ?','0')
                ->order('id DESC');
$row = $this->fetchAll($select);

编辑:

$select = $this->select()
               ->from(array('cwi_company'),array("*"))
                ->where('manage = ?','1') 
                ->where('deleteOption = ?','0')
                ->where('passwordStatus = ?','1')
                ->where('organizationuserid IN (SELECT userId FROM cwi_passtable WHERE passwordAciveStatus =1)');
于 2013-05-20T10:01:26.110 回答