After I had a collection from a query, I want to sort it. Then, this error message came up:
Error Code : 907 Error Message : ORA-00907: missing right parenthesis Position : 202 Statement : select count(*) as aggregate from "ATTENDANCE_LISTS" where exists (select * from "MEETINGS" where "ATTENDANCE_LISTS"."MEETING_ID" = "MEETINGS"."ID" and "STATUS_MEETING" = :p0 and "START_MEETING" <= :p1 order by "START_MEETING" desc) Bindings : [Disetujui,2022-04-19 20:11:24] (SQL: select count(*) as aggregate from "ATTENDANCE_LISTS" where exists (select * from "MEETINGS" where "ATTENDANCE_LISTS"."MEETING_ID" = "MEETINGS"."ID" and "STATUS_MEETING" = Disetujui and "START_MEETING" <= 2022-04-19 20:11:24 order by "START_MEETING" desc))
The code is as follows:
$meetings2 = AttendanceLists::whereHas('meeting', function ($query) {
$now = new DateTime("now");
$query->where('status_meeting', '=', 'Disetujui')
->where('start_meeting', '<=', $now)
->orderBy('start_meeting', 'desc')
;
})->paginate(5);
I only built the query with the Laravel eloquent method above, and I have been struggling with this for days. Please help me.
Yes, there's a seemingly similar post right here: ORA-00907: missing right parenthesis
But, the problem I have has nothing to do with manually constructing the query with SQL format. I constructed the query using PHP Laravel eloquent method, so it can't really be about a missing parenthesis.**
Edit: In a nutshell, the problem comes when I tried to order the AttendanceLists by the attribute of 'meeting' (order by an attribute of an attribute). Any help?