BigQuery: Subselect not allowed in SELECT clause
\n\nI used the following query in Google BigQuery:
\n\nSELECT count_in_bin/(SELECT SUM(count_in_bin) FROM [table])\nFROM [table]\n
\n\nThen I get
\n\n\n\n\nerror:Query Failed\n Error: Subselect not allowed in SELECT clause
\n
Solution:
BigQuery Standard SQL
#standardSQL\nSELECT \n count_in_bin, \n count_in_bin / total AS ratio\nFROM `project.dataset.table`, \n(SELECT SUM(count_in_bin) total FROM `project.dataset.table`)\n
Mike-Barn
posted onEnjoy great content like this and a lot more !
Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds
Post Comment