Skip to content
Advertisement

Fix duplicate rows while selecting nested fields from BigQuery using JOIN and UNNEST

I am trying to copy data from one BQ table to another and having trouble with un-nesting and JOINs. I have two fields of REPEATED RECORD type in my schema and when I try to JOIN those, I get a lot of duplicate rows. Here´s my query:

What I want to achieve is:

But when I JOIN Address and Work, I get a log of duplicate rows like this:

I need help with fixing the JOINS and would appreciate some suggestions. Thanks in advance.

Advertisement

Answer

Try subqueries:

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