22 Sep 19 ·  nVector in Bigquery ·        Bookmark ·  Report ·  More actions.. Lock comments ·  Pin thread

Subqueries in Bigquery - syntax

A subquery is a query that appears inside another statement, and is written inside parentheses. These are also referred to as "sub-SELECTs" or "nested SELECTs". The full SELECT syntax is valid in subqueries

( SELECT * FROM Roster) AS r;

NOTE: If you are using a subquery in a filter clause, Bigquery supports selecting only one column:

SELECT LastName FROM Employee Where EMP_ID IN

If you have more than one column as part of your subquery in the filter clause, you will get the below error message:

Error: Scalar subquery produced more than one element

If you get the above error message, you will have to rewrite your SQL Query differently to get rid of that filter


posted on 22 Sep 19

Enjoy 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