【问题标题】:Getting all comments of multiple users from a certain subreddit - Reddit Dataset从某个 subreddit 获取多个用户的所有评论 - Reddit Dataset
【发布时间】:2016-07-18 14:09:32
【问题描述】:

我想获取在特定 subreddit 中发表评论的每个 redditor 的所有 cmets,例如 r/gaming。 我知道如何查询 subreddits:

SELECT * FROM [fh-bigquery:reddit_comments.2007]
WHERE subreddit = "gaming"

但我的 SQL/BigQuery 知识太有限,无法获取所有在 subreddit 中发表评论的 redditor 的 cmets。

我在想类似的事情

SELECT author FROM [fh-bigquery:reddit_comments.2007]
WHERE subreddit = "gaming"

但这只是给了我在 r/gaming 中发表评论的用户的作者姓名。

如何搜索某个特定 subreddit 的作者并获取他们在所有 subreddit 中的所有提交? Here is the link to the used BigQuery-table.

谢谢!!

【问题讨论】:

    标签: sql google-bigquery


    【解决方案1】:

    下面试试

    SELECT * FROM [fh-bigquery:reddit_comments.2007]
    WHERE author IN (
      SELECT author FROM [fh-bigquery:reddit_comments.2007]
      WHERE subreddit = "gaming"
      GROUP BY 1
    )
    

    【讨论】:

    • 这似乎可行,谢谢! GROUP BY 1 根据什么对数据集进行分组?如果按作者排序就好了。
    • GROUP BY 1 按 SELECT 语句中的第一个字段分组 - 在这种情况下 - 按作者
    猜你喜欢
    • 2015-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-14
    • 2019-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多