场景:** 先排序,后分组
    函数:
    GROUP_CONCATE(表达式**)
    SELECT GROUP_CONCATE(表达式) FROM table
    把所有查询结果的该字段 以“,”分割
    显示在 “group_concat(表达式)” 字段上
    eg:
    group_concat(create_time order by create_time DESC)
    group_concat(create_time);

    SELECT GROUP_CONCATE( create_time order by create_time DESC) abc FROM table
    时间倒叙
    字段名 abc
    字段值 “时间4,时间3,时间2,时间1”
    SELECT GROUP_CONCATE( create_time) FROM table
    时间正序
    字段名 abc
    字段值 “时间1,时间2,时间3,时间4”

    整合字符串截取
    SELECT **SUBSTRING_INDEX(GROUP_CONCATE(create_time ORDER BY create_time DESC),’,’,1) FROM table GROUP BY **groupField
    image.png


    **