【发布时间】:2020-01-29 22:09:13
【问题描述】:
我根据 BigQuery 中最接近的时间戳加入两个表并收到此错误。连接谓词中的表不支持子查询。
SELECT gs.user_session_id
,dtc._date
,dtc.hit_timestamp _timestamp
,dtc.user_id
FROM ga.2_deduped_twice_click_data dtc LEFT JOIN ga.sessions gs ON dtc.user_id = gs.user_id
and dtc.hit_timestamp = ( SELECT dtc2.hit_timestamp FROM ga.2_deduped_twice_click_data dtc2 order by ABS(TIMESTAMP_DIFF(dtc.hit_timestamp, gs._timestamp, MILLISECOND)) LIMIT 1 )
【问题讨论】:
-
ROW_NUMBER() OVER(PARTITION BY dtc.user_id, dtc._date ORDER BY ABS(TIMESTAMP_DIFF(dtc._timestamp, gs._timestamp, SECOND))) 作为 row_num。 -- 在 row_num=1 的下一阶段过滤器中
标签: google-analytics google-bigquery