Jul 14, 2024
5
Level 8
Rewrite my query to equalent
Hi!
I have not created this query as equalent query.
Is there som good equalent tutorials out there ?
Her is my query;
$query = DB::table('gpstrackers')
->select('gpstrackers.*', 'users.name')
->leftJoin('users', 'gpstrackers.player_id_ref', '=', 'users.id')
->whereIn('gpstrackers.id', function ($query) use ($from1, $to1, $golfID, $courceid, $status) {
$query->selectRaw('MAX(gpstrackers.id) as id')
->from('gpstrackers')
->join('startlists_participants', 'gpstrackers.startliste_participant_ref_id', '=', 'startlists_participants.id')
->join('startlists', 'startlists_participants.startlist_id', '=', 'startlists.id')
->whereBetween('gpstrackers.regdate', [$from1, $to1])
->where('gpstrackers.golfclub_id', $golfID)
->where('startlists.status', $status)
->where('gpstrackers.courcegolfclub_id', $courceid)
->groupBy('gpstrackers.flight');
})
->get();
Please or to participate in this conversation.