I am using google bigQuery to analyze the amazon book review dataset. The dataset has a 'helpful' column which looks like this: 'helpful' :[0, 0] where the first element is a 'yes' vote and the second is a 'total' vote.
When I upload the data inn bigQuery, it splits the column into two rows because it does not support the array format. bigQuery screenshot. Using the 'apply series' method in python pandas I can split the helpful column into two columns- 'helpful vote' and 'total vote': jupyter notebook screenshot
If I write this query to do the same in BQ:
SELECT TA1.reviewerID, TA1.helpful AS yes, TA2.helpful AS total
FROM table_name as TA1
LEFT JOIN table_name as TA2
ON TA1.reviewerID = TA2.reviewerID and TA2.helpful != TA1.helpful
GROUP BY TA1.reviewerID
I get the following error: Error: (L1:27): Expression 'TA1.helpful' is not present in the GROUP BY list.
The same query works in my sqlite3. What am I doing wrong in BQ?
Thanks,