这是我的问题:
$select = $this->_conn->select();
$select->from(array('usr' => $this->_prefix . 'user'));
$select->join(array('rol' => 'role'), 'usr.role_id = rol.role_id',array());
$select->join(array('law' => 'lawyer_details'), 'usr.user_id = law.user_id', array('lawyer_url'));
$select->where("usr.user_status = ?","yes");
$select->where("rol.role_key = ?","yes");
$select->where("usr.user_section_show = ?","yes");
$select->where("usr.managment_show = ?","yes");
$select->limit(4);
$select->order(array('usr.user_firstname ASC'));
$rs = $select->query()->fetchAll();
return new Obt_Model_RecordSet($rs, $this);
我想要通过user_firstname订购,但首先要获得的用户名称为" xxx"," yyy"," lll &#34 ;;
答案 0 :(得分:1)
- >订单(新Zend_Db_Expr(" FIELD(usr.user_firstname,' xxx',' yyy',' lll')&# 34));
答案 1 :(得分:0)
试试这个: -
order by (user_firstname='xxx') DESC,user_firstname ASC
答案 2 :(得分:0)
在标准SQL中,您可以使用:
order by
(case when usr.user_firstname in ('xxx', 'yyy', 'III') then 1 else 0 end) DESC,
usr.user_firstname ASC