通过代码

select
       start_month,
       mau,
       month_add_uv,
       max(month_add_uv)over(order by start_month),
       sum(month_add_uv)over(order by start_month )
from(
    select
           date_format(start_time,'%Y%m')  start_month,
           count(distinct uid)  mau,
           count(distinct IF((date_format(start_time, '%Y%m'), uid) in
                              (select
                                      min(date_format(start_time, '%Y%m')),
                                      uid
                              from
                                   exam_record
                              group by uid
                              ), uid,null)) month_add_uv
     from
          exam_record
     group by
          start_month
    )t
order by
         start_month

其实这道题也没多难,就是这个题目解释的活跃矩阵给我带坑里去了,我一直在想怎么把这个活跃矩阵给整出来,结果直接卡死在了动态行转列,qaq有大佬能给孩子讲讲怎么动态行转列吗??