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 r.LastName FROM
( 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
( SELECT EMP_ID FROM DEPT);
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
nVector
posted on 22 Sep 19Enjoy 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