假设你想知道你关注的哪些好友很久没玩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
强烈推荐
- 英国代购-畅购英伦
- TopCashBack 返现 (英国购物必备, 积少成多, 我2年来一共得了3000多英镑)
- Quidco 返现 (也是很不错的英国返现网站, 返现率高)
- 注册就送10美元, 免费使用2个月的 DigitalOcean 云主机(性价比超高, 每月只需5美元)
- 注册就送10美元, 免费使用4个月的 Vultr 云主机(性价比超高, 每月只需2.5美元)
- 注册就送10美元, 免费使用2个月的 阿里 云主机(性价比超高, 每月只需4.5美元)
- 注册就送20美元, 免费使用4个月的 Linode 云主机(性价比超高, 每月只需5美元) (折扣码: PodCastInit2022)
- PlusNet 英国光纤(超快, 超划算! 用户名 doctorlai)
- 刷了美国运通信用卡一年得到的积分 换了 485英镑
- 注册就送50英镑 – 英国最便宜最划算的电气提供商
- 能把比特币莱特币变现的银行卡! 不需要手续费就可以把虚拟货币法币兑换
微信公众号: 小赖子的英国生活和资讯 JustYYUK