jeudi 27 juin 2019

How I can optimize this laravel query builder query?

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.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2XcsAoq
via IFTTT

Aucun commentaire:

Enregistrer un commentaire