假设你想知道你关注的哪些好友很久没玩STEEM了, 你可以通过 @arcange 的 STEEMSQL 来进行查询. 我们可以简单的定义7天内如果用户没有发表评论或者文章就算没玩(因为可以通过机器人自动点赞)
1 2 3 4 5 6 7 8 9 10 | select author, datediff(day, T.last, GetUTCDate()) from ( select author, max(created) "last" from Comments where author in ('followingid1', 'followingid2' ...) group by author ) T where datediff(day, T.last, GetUTCDate()) > 7 |
select author, datediff(day, T.last, GetUTCDate()) from ( select author, max(created) "last" from Comments where author in ('followingid1', 'followingid2' ...) group by author ) T where datediff(day, T.last, GetUTCDate()) > 7
嵌套的SQL用于按用户排序并返回最近一次活动时间 last. 主SQL则把这时间再一次过滤, 去掉7天内有活动的用户: datediff(day, T.last, GetUTCDate()) > 7
我们可以把时间天数间隔保存在嵌套的SQL里当成一字段, 我们还可以从视图 Followers 中取得关注的列表.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | select author, T.days from ( select author, max(created) "last", datediff(day, max(created), GetUTCDate()) "days" from Comments where author in ( select following from followers where follower = 'justyy' ) group by author ) T where T.days > 7 order by T.days desc |
select author, T.days from ( select author, max(created) "last", datediff(day, max(created), GetUTCDate()) "days" from Comments where author in ( select following from followers where follower = 'justyy' ) group by author ) T where T.days > 7 order by T.days desc
上面的SQL就返回了我关注的这用户中已经不玩STEEM的, 你也试试看吧?
STEEM SQL 系列教程
- STEEM SQL 系列教程之 随机返回是怎么实现的?
- STEEM SQL 系列教程之 如何获取最近7天 CN 区用户发贴量, 点赞数和估计收益值?
- STEEM SQL 系列教程之 历史上的今天怎么实现的?
- STEEM SQL 系列教程之 每个月能挣多少?
- STEEM SQL 系列教程之 真的可以恢复删除的文章或评论么?
- STEEM SQL 系列教程之 大鱼们都给谁投票了?
- STEEM SQL 系列教程之 办银行一个月共发了多少利息?
- STEEM SQL 系列教程之 你的哪些好友已经好久没玩STEEM了?
- STEEM SQL 系列教程之 如何使用 ISJSON 和 JSON_VALUE 函数?
- STEEM SQL 系列教程之 如何获取史上赚最多金的作者?
- STEEM SQL 系列教程之 一鸣惊人的作者
- STEEM SQL 系列教程之 如何避免 SQL 注入?
- STEEM SQL 系列教程之 我花了800多 SBD (7000多美元)买赞
- STEEM SQL 系列教程之 怎么样查看 STEEMSQL 是否数据同步完全?
英文: SteemSQL Tutorial – Finding Inactive Steemians that You Follow
GD Star Rating
loading...
本文一共 410 个汉字, 你数一下对不对.loading...
上一篇: [答案] 数学 × 程式编写比赛 (第八回) - 4位数的电子显示器
下一篇: 说说计算机证书
扫描二维码,分享本文到微信朋友圈