美文网首页
2020-11-16(laravel表关联)

2020-11-16(laravel表关联)

作者: 浪子游剑 | 来源:发表于2020-11-16 00:58 被阅读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();

相关文章

网友评论

      本文标题:2020-11-16(laravel表关联)

      本文链接:https://www.haomeiwen.com/subject/irxabktx.html