我试图解决这种情况。我有一张结果表。到目前为止,我使用了->orderBy('final'(,但当我有同样的最后时间时,我发现它不起作用。
Left time | Right time | Final
0 24:45 24:22 24:45
1 24:85 21:84 24:85
2 24:44 25:12 25:12
3 25:12 21:78 25:12
4 38:12 25:99 38:12
问题是,当我有相等的最终时间(如索引[2]、[3](时,以及当出现这种情况时,我希望检查更好的时间左时间或 右时间所以最后它必须看起来像(索引2,3切换(Left time | Right time | Final
0 24:45 24:22 24:45
1 24:85 21:84 24:85
2 25:12 21:78 25:12
3 24:44 25:12 25:12
4 38:12 25:99 38:12
您可以使用以下
Model::orderByRaw("column1 DESC, column2 DESC");
->get();
您可以多次使用orderBy。
MyTable::orderBy('column1', 'DESC')
->orderBy('column2', 'ASC')
->get();