Row | id | name |
---|---|---|
1 | 1 | A |
2 | 1 | B |
3 | 2 | A |
4 | 3 | A |
Last active
September 30, 2016 07:38
-
-
Save yancya/53c8a0816c3de9ac4fc49fca436700d4 to your computer and use it in GitHub Desktop.
BigQuery の Standard SQL で Legacy SQL の FLATTEN(table_name) 相当の処理を行う SQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH t AS ( | |
SELECT * | |
FROM UNNEST(ARRAY<STRUCT<id INT64, `names` ARRAY<STRING>>> | |
[(1, ['A', 'B']), (2, ['A']), (3, ['A'])])) | |
SELECT t.id | |
, `name` | |
FROM t | |
JOIN UNNEST(t.`names`) AS `name` | |
ORDER BY 1, 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment