Skip to content
Advertisement

In BigQuery, match two tables according to a calculated value of one table

I have two tables in BigQuery: one containing the places of road cameras, named cameras

…and another containing accidents, named accidents.

I need to inspect how many accidents happened in the range of 0.5 mile before and 0.5 mile after the cameras.

So, what I need to do is:

  1. Establish a .5-mile perimeter in table named cameras;
  2. Check how many accidents in table accidents happened in each .5-mile perimeter of table cameras.

How can I do that? Any help?

Advertisement

Answer

Below is for BigQuery Standard SQL

if to apply to sample data from your question – result is

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement