$rows = db('member')//表别名
->alias('m')//定义一个别名
->join('agent a','m.m_pid=a.id','left')//与agent表进行关联,取名a,并且a表的id字段等于m表的m_pid字段
->where('m.status',1)//条件:状态为1
->order('id desc')//根据id降序排列
->limit(10)//限制10条
->field(['m.*','a.uname as agentname','s.username','d.kname']) //想要的字段
->select();