Skip to content
Advertisement

Tag: google-bigquery

How to find the average distance between the locations

I have a table with source, destination and distance between the locations like as below i want to calculate average distance between the locations like, for example if we take A to B route 1: 21 miles, route 2: 28 miles, route 3: 19 miles I am expecting results: A to B –> 22.66 miles Thanks Answer Below is for

Big Query – Convert INT to Date

Can not find any solution to this: Need to convert date(int) in the format – 20190101 to DATE in the format “2019-01-01” I have tried: Cast(cast(20190101 AS STRING) AS date) FORMAT_DATE(“%F”,CAST(20190101 AS STRING)) And so on…no success Answer You are looking for PARSE_DATE():

Bigquery: Select top 3 with Group By condition

I have a table like this I want to select the top 3 total by groups. How can i do it? Answer In most [big data] use cases using ROW_NUMBER() is not fine as it ends up with resource exceeded error. This is because it requires all point of same group be present in same/one node which in case of

Advertisement