你好!我在 Codecademy 社区 上看到,他们根据成员阅读时长设置了 3 个徽章。有人知道如何创建类似的徽章吗?
目前我受该“阅读者”徽章启发制作了这样一个徽章,但我不清楚这个数字代表什么(在我的情况下,26 是显示我有资格获得该徽章的最大数值)。
SELECT user_id, count(*) c, CURRENT_DATE as granted_at FROM post_timings GROUP BY user_id HAVING count(*) >= 26
以下是我的统计数据(我感兴趣的总阅读时长):
此查询列出了阅读帖子超过 480 小时的用户。希望这能帮到您。
-- 毫秒转换:[小时数 * 3600000]:480 * 3600000 = 1,728,000,000 WITH time_reading AS ( SELECT user_id, SUM(msecs) AS hours FROM post_timings GROUP BY user_id HAVING SUM(msecs) >= 1728000000) SELECT user_id, CURRENT_TIMESTAMP AS granted_at FROM time_reading
您的查询运行正常,非常感谢!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.