How to splice order by field in orderBy in yii,
, now the printed sql
, and the sql I need is like this
, please tell me how to solve this problem, this is the reference in mysql Order by field (id, 5, 3, 8) Another point, in the Yii framework, I want to implement a special sorting of a certain field. Is there any other method besides order by field? I checked several methods and it is all due to "` "Error caused by this symbol###
->orderBy(["FIELD(step, 'star', 'person', 'team')" => true])
is OK, but I didn't look at the underlying code carefully. . . But it should solve the problemThis is a method to generate an orderby statement, so true has no real effect, but it is not equal to SORT_DESC and then becomes empty,
The more official way of writing it is like this: