$res = db("admin")->alias("a")->join("auth_group_access g","a.id=g.uid")->paginate(2); $tempArr = $res->all(); foreach ($tempArr as $k => $v){ $groupName = db("auth_group")->field("title")->where("id",$v['group_id'])->find(); $v['groupName'] = $groupName['title']; $res[$k] = $v; }