如何在Laravel Query构建器中创建它

时间:2016-01-07 03:25:56

标签: laravel builder

SELECT e.match_id,e.team_id 来自match_events LEFT JOIN {{1}} e ON e.match_id = matches.id AND e.match_event_type_id = 1

1 个答案:

答案 0 :(得分:1)

试试这个,

   $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();