Skip to content

Instantly share code, notes, and snippets.

@neuecc
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neuecc/90e19117609c86b82fe2 to your computer and use it in GitHub Desktop.
Save neuecc/90e19117609c86b82fe2 to your computer and use it in GitHub Desktop.
join

JOIN clause https://developers.google.com/bigquery/query-reference#joins

SELECT field_1 [..., field_n] FROM
   table_1 [[AS] alias_1]
 [[INNER|LEFT OUTER|CROSS] JOIN [EACH]
   table_2 [[AS] alias_2]
  [ON join_condition_1 [... AND join_condition_n]]
 ]+

BigQuery supports multiple JOIN operations.

  • CROSS JOIN clauses must not contain an ON clause.
  • The EACH modifier can't be used in CROSS JOIN clauses

Method Signature?

enum JoinType
{
    Inner,
    InnerEach
    LeftOuter,
    LeftOuterEach
}

Join(rightSource, mergeCondition, aliasSelector) // JoinType.Inner
Join(joinType, rightSource, mergeCondition, aliasSelector)
JoinCross(rightSource, aliasSelector) // CROSS JOIN must not contains mergeCondition

.From()
.Join(ys, (x, y) => x.hoge == y.hoge, (x, y) => new { wiki = x, goog = y })
.Join(zs, (x, y) => x.wiki.hoge == y.hoge, (x, y) => new { x.wiki, x.goog, huga = y })
.GroupBy...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment