From c9603e1dab2fd6f8455a700e08718663a16b61a6 Mon Sep 17 00:00:00 2001 From: Karolis Matulionis Date: Tue, 15 May 2018 14:29:42 +0200 Subject: [PATCH 1/2] Update processData.SQL subreddit ambiguity A fix for Bigquery Error: 2.40 - 2.68: Ambiguous column name subreddit. --- subreddit-algebra/processData.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subreddit-algebra/processData.sql b/subreddit-algebra/processData.sql index b25765a..9d8a580 100644 --- a/subreddit-algebra/processData.sql +++ b/subreddit-algebra/processData.sql @@ -12,7 +12,7 @@ FROM (SELECT subreddit, SUM(1) as authors ORDER BY authors DESC; # 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 +SELECT t1.subreddit as t1_subreddit, t2.subreddit as t2_subreddit, SUM(1) as NumOverlaps FROM (SELECT subreddit, author, COUNT(1) as cnt FROM [fh-bigquery:reddit_comments.all_starting_201501] WHERE author NOT IN (SELECT author FROM [fh-bigquery:reddit_comments.bots_201505]) @@ -25,4 +25,4 @@ JOIN (SELECT subreddit, author, COUNT(1) as cnt GROUP BY subreddit, author HAVING cnt > 10) t2 ON t1.author=t2.author WHERE t1.subreddit!=t2.subreddit -GROUP BY t1.subreddit, t2.subreddit \ No newline at end of file +GROUP BY t1.subreddit, t2.subreddit From 4a52d40cc698fd83089234384e27e52f0e196f3c Mon Sep 17 00:00:00 2001 From: Karolis Matulionis Date: Tue, 15 May 2018 22:54:15 +0200 Subject: [PATCH 2/2] Update processData.sql --- subreddit-algebra/processData.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subreddit-algebra/processData.sql b/subreddit-algebra/processData.sql index 9d8a580..226b0b4 100644 --- a/subreddit-algebra/processData.sql +++ b/subreddit-algebra/processData.sql @@ -25,4 +25,4 @@ JOIN (SELECT subreddit, author, COUNT(1) as cnt GROUP BY subreddit, author HAVING cnt > 10) t2 ON t1.author=t2.author WHERE t1.subreddit!=t2.subreddit -GROUP BY t1.subreddit, t2.subreddit +GROUP BY t1_subreddit, t2_subreddit