Skip to content

Instantly share code, notes, and snippets.

@ijokarumawak
Created October 6, 2015 14:58
Show Gist options
  • Save ijokarumawak/3108e1fde2a57b94a540 to your computer and use it in GitHub Desktop.
Save ijokarumawak/3108e1fde2a57b94a540 to your computer and use it in GitHub Desktop.
// r.scheduleでUNNEST
SELECT META(r).id as rid, r.airlineid, r.equipment, s.flight, s.utc
FROM `travel-sample` r
UNNEST r.schedule AS s
WHERE r.sourceairport = "SFO"
AND r.destinationairport = "LAX"
ORDER BY rid ASC, s.utc ASC
LIMIT 2;
// 結果
[{
"airlineid": "airline_439",
"equipment": "738",
"flight": "AS639",
"rid": "route_11981",
"utc": "02:13:00"
},
{
"airlineid": "airline_439",
"equipment": "738",
"flight": "AS599",
"rid": "route_11981",
"utc": "03:52:00"
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment