SQL函数Group_concat用法

语法
group_concat([DISTINCT] 要连接的字段 [Order BY ASC/DESC 排序字段] [Separator ‘分隔符’])
 

示例:

$data = db('user_card')
    ->where('status', '<>', 9)
    ->group('phone')
    ->field('id,name,phone,store_id,unionid,GROUP_CONCAT(store_id) store_ids')
    ->select()->toArray();