您好,登錄后才能下訂單哦!
1、統計9月注冊角色首次充值時的游戲時長分布(分鐘,人數),單位:分鐘
SELECT sub.minutes, Count(roleId) AS count FROM (SELECT pr.roleId, Timestampdiff(MINUTE, Max(player_login.logTime), pr.logTime) + Ifnull(Max(player_logout.totalOnlineMins), 0) AS minutes FROM (SELECT logTime, roleId FROM player_recharge WHERE createTime >= '2017-09-01' AND createTime < '2017-10-01' AND rechargeTimes = 1) AS pr LEFT JOIN player_logout ON player_logout.roleId = pr.roleId LEFT JOIN player_login ON player_login.roleId = pr.roleId WHERE player_logout.logTime < pr.logTime AND player_login.logTime < pr.logTime GROUP BY pr.roleId) AS sub WHERE sub.minutes > 0 GROUP BY sub.minutes;
2、按天分組,查9月每天付費前10排行(日期,付費金額,排名,角色ID)
SELECT date AS 'date', pay AS 'pay', rank, roleId FROM ( SELECT zl_tmp.roleId, zl_tmp.date, zl_tmp.pay, @rownum := @rownum + 1, IF( @date = zl_tmp.date, @rank := @rank + 1, @rank := 1 ) AS 'rank', @date := zl_tmp.date FROM ( SELECT roleId, SUM(cash) AS 'pay', DATE_FORMAT(logTime, '%Y-%m-%d') AS 'date' FROM player_recharge WHERE logTime >= '2017-09-01' AND logTime < '2017-10-01' GROUP BY date, roleId ORDER BY date, pay DESC ) zl_tmp, ( SELECT @rownum := 0, @date := NULL, @rank := 0 ) a ) result HAVING rank <= 10;
3、統計9月每日付費轉化率(日期,活躍用戶數,付費用戶數)
SELECT pl.date, pl.plCount AS activeAccoCount, COALESCE(pr.prCount, 0) AS payAccoCount FROM ( SELECT Date_format(logTime, '%Y-%m-%d') AS date, Count(DISTINCT roleId) AS plCount FROM player_login WHERE logTime >= '2017-09-01' AND logTime < '2017-10-01' GROUP BY date ) AS pl LEFT JOIN ( SELECT Date_format(logTime, '%Y-%m-%d') AS date, Count(DISTINCT roleId) AS prCount FROM player_recharge WHERE logTime >= '2017-09-01' AND logTime < '2017-10-01' GROUP BY date ) AS pr ON pl.date = pr.date;
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。