好的,我是 SQL 和 Big Query 的新手,遇到了一个不明确的列名错误。我检查了堆栈溢出的其他答案,但找不到/理解我的问题的答案。所以我得到:错误:2.40 - 2.68:不明确的列名 subreddit。
对于这段代码(我改编自另一个人对类似事物的分析):
#legacySQL
# Creating list of number of users who authored at least 10 posts in pairs of subreddits:
SELECT t1.subreddit, t2.subreddit, SUM(1) as NumOverlaps
FROM (SELECT subreddit, author, COUNT(1) as cnt
FROM (TABLE_QUERY([fh-bigquery:reddit_comments],
'table_id CONTAINS "2017_" AND length(table_id) >= 5'))
GROUP BY subreddit, author HAVING cnt > 5) t1
JOIN (SELECT subreddit, author, COUNT(1) as cnt
FROM(TABLE_QUERY([fh-bigquery:reddit_comments],
'table_id CONTAINS "2017_" AND length(table_id) >= 5'))
GROUP BY subreddit, author HAVING cnt > 5) t2
ON t1.author=t2.author
WHERE t1.subreddit!=t2.subreddit
GROUP BY t1.subreddit, t2.subreddit
谢谢你的帮助!