Laravel 有子查询的联合查询

Laravel 有子查询的联合查询

s u b S q l = D B : : t a b l e ( ′ b a s e m e s s a g e ′ ) − > w h e r e ( subSql = DB::table('base_message') ->where( subSql=DB::table(basemessage)>where(where)
->selectRaw(‘message_id,from_user_id,count(from_user_id) AS admin_no_reply_count’)
->groupBy(‘from_user_id’)
->orderBy(‘message_id’, ‘desc’)
->paginate(20);
g r i d − > m o d e l ( ) − > f r o m S u b ( grid->model() ->fromSub( grid>model()>fromSub(subSql, ‘a’)
->join(‘base_message’,‘base_message.message_id’,‘a.message_id’)
->get();

你可能感兴趣的:(laravel)