$subsql = Db::table('think_work') ->where('status',1) ->field('artist_id,count(id) count') ->group('artist_id') ->buildSql(); Db::table('think_user') ->alias('a') ->join([$subsql=> 'w'], 'a.artist_id = w.artist_id') ->select();
表名也可以是一个子查询