成为成员的潜水者
大家好,
我对此还比较陌生,但哇——这真是一个酷工具!
这是我创建的一个(非常简单的!)查询,可帮助您轻松识别在过去几个月内成为成员的潜水者。
-- [params]
-- int :last_months = 2
-- int :posts_read = 1000
-- int :posts_written = 0
SELECT users.id, users.username,
users.created_at, users.last_seen_at,
user_stats.posts_read_count, user_stats.post_count
FROM users INNER JOIN user_stats
ON users.id = user_stats.user_id
WHERE users.created_at < now() - interval ':last_months months'
AND user_stats.posts_read_count > :posts_read
AND user_stats.post_count <= :posts_written
ORDER BY user_stats.posts_read_count DESC
三个参数(相当直观):
-
last_months
我们希望回溯多少个月以查找新用户,并判断他们是否确实是潜水者(默认:过去 2 个月内的新账户) -
posts_read
在被视为潜水者之前,他们必须阅读多少帖子(默认:1,000) -
posts_written
人们最多可以发布多少帖子仍被视为潜水者(默认:0)
我添加了最后一个参数,以便能够筛选出那些仅发布“嗨!这里真不错!”之类内容,之后便不再发帖的人。
请注意:我已根据 @jerdog 指出的问题(见下文帖子)对脚本进行了小幅更新——感谢 J. 发现此问题!