thinkphp5关联查询多表查询join
2023-03-29 23:03:03
215
{{single.collect_count}}

thinkphp5关联查询多表查询join

一对多查询

$rows = db('member')->alias('m')->join('agent a','m.m_pid=a.id','left')//左表交集->join('salesman s','a.a_pid=s.id')->join('admin d','m.w_id=d.id')->where('m.status',1)//条件:状态为1->order('id desc')//根据id降序排列->limit(10)//限制10条->field(['m.*','a.uname as agentname','s.username','d.kname'])//显示的字段->select();

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}