TP5一张表中根据某一字段相同值得另一字段的所有值拼接起来,组成一条新的语句

我的用途在foreach里面,主要内容是group_concat

        $phone_list = Db::name("matchingfriend")
                ->field("phone_number, group_concat(amount) amount")
                ->group('phone_number')
                ->select();

其实就是group_concat与group一起使用,但这里要注意一下,如果你和我一样是在遍历里面查询,就使用find();

猜你喜欢

转载自blog.csdn.net/qq_28137309/article/details/81164926