BigQuery: convert epoch to TIMESTAMP

前端 未结 2 1030
忘掉有多难
忘掉有多难 2021-02-13 06:14

I\'m trying to range-join two tables, like so

SELECT *
FROM main_table h
INNER JOIN
    test.delay_pairs d
ON
    d.interval_start_time_utc < h.visitStartTime         


        
2条回答
  •  后悔当初
    2021-02-13 07:04

    You can use timestamp conversion functions like TIMESTAMP_SECONDS, TIMESTAMP_MILLIS, TIMESTAMP_MICROS

    for example, assuming your h.visitStartTime is microseconds since the unix epoch

    SELECT *
    FROM main_table h
    INNER JOIN test.delay_pairs d
    ON d.interval_start_time_utc < TIMESTAMP_MICROS(h.visitStartTime)
    AND TIMESTAMP_MICROS(h.visitStartTime) < d.interval_end_time_utc  
    

提交回复
热议问题