我有4张桌子
Announcements_reviews
用户
公告
行李公告
Announcements_reviews 与公告和用户
有关系公告与行李公告
有关系如何直接从 Announcements_reviews表
中获取 Bagage_Announcements 字段我这样做了,但是没用
$bagage=DB::table('announcements_reviews_comments')
->join('users','users.id','announcements_reviews_comments.user_id')
->join('announcements','announcements.id','announcements_reviews_comments.id_announcement')
->join('bagage_announcements','bagage_announcements.id_announcement','annoucements.id')
->select(DB::raw('id_announcement as Announcement'),DB::raw('avg(note) as Note'),DB::raw('users.email'),DB::raw('announcements.type'))
->groupBy(DB::raw('id_announcement') )
->get();