Skip to content

Instantly share code, notes, and snippets.

@ijokarumawak
Created October 6, 2015 15:00
Show Gist options
  • Save ijokarumawak/74783245aa21005d39e4 to your computer and use it in GitHub Desktop.
Save ijokarumawak/74783245aa21005d39e4 to your computer and use it in GitHub Desktop.
// r.airlineidでJOIN
SELECT META(r).id as rid, META(a).id as aid, a.name, r.equipment, s.flight, s.utc
FROM `travel-sample` r
UNNEST r.schedule AS s
JOIN `travel-sample` a ON KEYS r.airlineid
WHERE r.sourceairport = "SFO"
AND r.destinationairport = "LAX"
ORDER BY rid ASC, s.utc ASC
LIMIT 2;
// 結果
[{
"aid": "airline_2009",
"equipment": "E75",
"flight": "DL388",
"name": "Delta Air Lines",
"rid": "route_21755",
"utc": "00:14:00"
},
{
"aid": "airline_2009",
"equipment": "E75",
"flight": "DL877",
"name": "Delta Air Lines",
"rid": "route_21755",
"utc": "01:33:00"
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment