gpt4 book ai didi

mysql - 如何在 SQL 中订购包括单词顺序

转载 作者:行者123 更新时间:2023-11-29 02:53:05 27 4
gpt4 key购买 nike

这是我的查询:

$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”的用户;

最佳答案

->order(new Zend_Db_Expr("FIELD(usr.user_firstname, 'xxx','yyy','lll')"));

关于mysql - 如何在 SQL 中订购包括单词顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33538757/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com