我得到`SQLSTATE[HY093]:无效的参数号:绑定变量的数量与标记的数量不匹配
select * from `starters` where `dummy` != 4 and `events_id` = 11
order by `dummy` asc, time_all, (error_1 + error_2), `time_1` asc`
在将我的laravel 8项目更新到Laravel 9之后,代码是
$starters = \App\Models\Starters::where('dummy','!=', 4 )
->where('events_id',request()->events_id)
->with('events')
->with('drivers')
->with('cars')
->orderBy('dummy','asc')
->orderByRaw('time_all','asc')
->orderByRaw('(error_1 + error_2)','asc')
->orderBy('time_1','asc')->get();
看不出问题,有什么建议吗?
1条答案
按热度按时间tf7tbtn21#
orderByRaw()子句不能像这里一样有反引号:
尝试如下操作: