'Updating a table from data in another table and multiple matches
First time posting here, normally I am able to find an answer to my questions by searching but not this time...
I have a table T1 with 2 sets of coordinates (start_coord and end_coord) but where some location information (start_loc_name, start_loc_id / end_loc_name, end_loc_id) are empty. I created another table (T2) with a list of all DISTINCT locations that each have loc_coord.
Now I'm trying to update missing location information (loc_name and loc_id) in T1 based on a match with the coordinates in T2. The problem is when I run an UPDATE query it fails because several T1 records match one T2 record (which is normal). All of this is done in BigQuery.
Is there a way to do that simply without creating 2 JOIN tables (one for each coordinate set)?
Thanks a lot in advance!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|