如何在find()方法中添加多个字段进行排序?
How to add more than one field to sort in find() method?
我尝试过如下
$model::find()->orderBy([['id_date' => SORT_DESC],['item_no'=>SORT_ASC]);
但是它在查询时抛出错误.yii2 产生的 Orderby Query 为:ORDER BY 0, 1
But it is throwing error with query.
Orderby Query produced by yii2 is: ORDER BY 0, 1
根据文档:
$model::find()->orderBy([
'id_date' => SORT_DESC,
'item_no'=>SORT_ASC
]);
这篇关于Yii2:如何在 Find() 的 orderby() 中添加两个字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!