Skip to content

Instantly share code, notes, and snippets.

@TobCap

TobCap/in.sql Secret

Created Aug 8, 2021
Embed
What would you like to do?
another way of making temporary table by using UNNEST
-- refers to https://pod.hatenablog.com/entry/2021/08/04/111107
WITH points AS (
select * from UNNEST(ARRAY<STRUCT<id int, p STRUCT<x int64, y int64>>>[
(1, (0, 10)),
(2, (0, 10)),
(2, (0, 10))
])
)
SELECT * FROM points
[
{
"id": "1",
"p": {
"x": "0",
"y": "10"
}
},
{
"id": "2",
"p": {
"x": "0",
"y": "10"
}
},
{
"id": "2",
"p": {
"x": "0",
"y": "10"
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment