0
votes

I am new in zend framework Below is my sql query in zend model

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

Basically it will fetch all the columns in the table. I want to select only 2 columns ie id and status but i don't know the syntax.

1

1 Answers

0
votes

Use the below code:

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

EDITED:

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