Reputation: 83
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
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