Athena 查询以查找一个月中有多少用户在其他月份

Athena query to find how many users from one month are in other months

我正在尝试获得经常使用的用户。我的日期在 S3 存储桶中,我正在使用 Amazon Athena 查询它。

我想知道 9 月 (9) 到 10 月 (10) 和 11 月 (11) 有多少用户...等

这是我获取此数据的查询:

我想在最后有这样的东西: recurrentusers

This is how my table after query looks like:

我知道你有一个像 active_users (month varchar, userid varchar) 这样的 table,或者你有办法产生这样的中间结果。

I'm interest to see how many users from September(9) are in October (10) and in November (11) ...etc

您可以通过以下方式实现所需:

SELECT month, count(*)
FROM active_users
WHERE userid IN (SELECT userid FROM active_users WHERE month = '2019-09')