Zend_Db order by field Value

后端 未结 2 636
北海茫月
北海茫月 2021-01-23 22:08

I\'m outputting the contents of a select menu from a model using this:

$select = $this->select();
$select->order(\'name\');
return $this->fetchAll($sele         


        
2条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-23 22:56

    I believe this is what you are looking for:

    $name = 'John';
    $order = new Zend_Db_Expr($this->getAdapter()->quoteInto("name = ?", $name) ." DESC, `name`");
    $select = $this->select();
    $select->order($order);
    return $this->fetchAll($select);
    

提交回复
热议问题