Yargo.ar
Yargo.ar

Reputation: 83

How create it in Laravel Query builder

SELECT e.match_id, e.team_id FROM matches LEFT JOIN match_events e ON e.match_id = matches.id AND e.match_event_type_id = 1

Upvotes: 0

Views: 247

Answers (1)

Jobin
Jobin

Reputation: 8282

Try this,

   $result = DB::table('matches as M')
          ->leftjoin('match_events as E','E.match_id','=','M.id')
          ->where('E.match_event_type_id',1)
          ->select(['E.match_id','E.team_id'])
          ->get();

Upvotes: 1

Related Questions