How to define a custom ORDER BY order in mySQL

后端 未结 4 2058
孤街浪徒
孤街浪徒 2020-11-22 12:53

In MySQL how do I define a custom sorting order.

To try to explain what I want consider this table:

ID  Language    Text
0   ENU         a
0   JPN           


        
4条回答
  •  星月不相逢
    2020-11-22 13:48

    For Yii2 framework we cab achieve by following way

    Project::find()
    ->orderBy([new Expression('FIELD(pid_is_t_m,2,0,1)'),'task_last_work'=> SORT_ASC])
    ->all();
    

提交回复
热议问题