The unit should be one of the following : FRAC_SECOND (microseconds), SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, or YEAR.
语法:
TIMESTAMPDIFF(unit,’2020-05-18’,’2020-07-20’);
时间日期是后减前
步骤:
1.先用lead()得到下次游戏的开始时间
2.调用此表,计算每次的游戏间隔,并计算平均值
where next_start_time is not null 删除最后一次游戏时间(包括只玩过一次的玩家)