ThinkPHP5 三表联合查询

 使用ThinkPHP5 查询构建起进行三表联合查询

        $account_info = Db::name('third_party_tasks')
            ->alias('a')
            ->join('third_party_taskgroups b','a.taskGroupId = b.taskGroupId')
            ->join('third_party_accounts c','b.account_id = c.id')
            ->field('c.access_token')
            ->where(['a.taskId' => $taskId])
            ->select();

具体讲解可以参考ThinkPHP5.0完全开发手册https://www.kancloud.cn/manual/thinkphp5/118083

猜你喜欢

转载自blog.csdn.net/supramolecular/article/details/82781931