2020-11-16(laravel表关联)
2020-11-16 本文已影响0人
浪子游剑
//SELECT t1.id,t1.article_name,t2.author_name FROM article as t1 LEFT JOIN author AS t2 ON t1.author_id=t2.id
$data=DB::table('article as t1')->select(DB::raw('t1.id,t1.article_name,t2.author_name'))
->leftJoin('author as t2','t1.author_id','=','t2.id')->get();