How I can optimize this query. This is working but I want optimal solution.
$query = AppUser::leftJoin( DB::raw('(SELECT user_id,question_id,answer FROM onlinetherapy_onboarding where question_id =8 GROUP BY user_id) b'), function($join) { $join->on('app_users.id', '=', 'b.user_id'); }) ->leftJoin( DB::raw('(SELECT user_id,status as verification_status FROM confirmation_codes GROUP BY user_id) c'), function($join) { $join->on('app_users.id', '=', 'c.user_id'); }) ->where('status','=', $user_status);
I expect optimal query.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire