LoginSignup
0
1

More than 1 year has passed since last update.

BigQuery | TABLE_DATE_RANGE テーブルに対して JOIN 出来ない

Last updated at Posted at 2016-06-22

問題

TABLE_DATE_RANGE はそのままじゃ JOIN できないっぽい。

SELECT
  *
FROM
  TABLE_DATE_RANGE(single.woman, TIMESTAMP('2016-12-24'), TIMESTAMP('2016-12-25') ) AS woman
LEFT JOIN
  [single.man] AS man
ON
  woman.left_hand = man.right_hand

Error: Field 'woman.left_hand' not found.

解決

サブクエリの内側に TABLE_DATE_RANGE を置く。

SELECT
  *
FROM (
  SELECT
    *
  FROM
    TABLE_DATE_RANGE(single.woman, TIMESTAMP('2016-12-24'), TIMESTAMP('2016-12-25') ) AS woman
LEFT JOIN
  [single.man] AS man
ON
  woman.left_hand = man.right_hand

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1