我正在尝试使用standardSql获取BigQuery中记录的平均间隔。我看了一些示例,但无法使其正常工作。
select timestamp_diff(timestamp, MIN(timestamp), MAX(timestamp)) / (COUNT(DISTINCT(timestamp), SECOND)
from `data-analysis.customer_analytics._aoi_table`
where flight_number = 'JL540' AND icao_address = '851958'
order by timestamp
下面是我的表格图像,我想获取列时间戳记中记录之间的平均间隔。
此方法:
select
timestamp_diff(max(timestamp),
min(timestamp),SECOND) / (COUNT(DISTINCT(timestamp)) - 1)
from `ais-data-analysis.customer_analytics.itochu_aoi_table`
where flight_number = 'JL540'
AND icao_address = '851958'