консоли запрос выполняется если параметр подставить..
$res = \DB::statement('SET @num=0; SELECT @num:=@num+1 as num, user_id, created_at FROM area_requests WHERE area_id = :id ORDER BY created_at DESC;', ['id'=>$area->id]);
Illuminate\Database\QueryException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT @num:=@num+1 as num, user_id, created_at FROM area_requests WHERE area_id' at line 1 (Connection: mysql, SQL: SET @num=0; SELECT @num:=@num+1 as num, user_id, created_at FROM area_requests WHERE area_id = :id ORDER BY created_at DESC;)
не умеет он так .. вот как надо https://laravel.io/forum/12-18-2014-how-to-initialize-user-defined-mysql-variables
уф, спасибо, сложновато как то )
Обсуждают сегодня