BigQuery SQL - UNION ALL
insights Stats
warning Please login first to view stats information.
Raymond
Code Snippets & Tips
Code snippets and tips for various programming languages/frameworks. All code examples are under MIT or Apache 2.0 license unless specified otherwise.
BigQuery supports UNION ALL clause in standard SQL though it doesn't support UNION clause.
BigQuery UNION ALL
The following statement shows an example of UNION ALL clause in SELECT statement.
SELECT 'A' AS Col1, 1 AS Col2 UNION ALL SELECT 'A' AS Col1, 1 AS Col2
Output (in JSON format):
[ { "Col1": "A", "Col2": "1" }, { "Col1": "A", "Col2": "1" } ]
UNION DISTINCT
UNION DISTINCT is similar as UNION (without ALL) in other databases:
SELECT 'A' AS Col1, 1 AS Col2 UNION DISTINCT SELECT 'A' AS Col1, 1 AS Col2
Output (in JSON format):
[ { "Col1": "A", "Col2": "1" } ]
info Last modified by Raymond 4 years ago
copyright
This page is subject to Site terms.
comment Comments
No comments yet.