Skip to content
Advertisement

Join the tables one to many but duplicate the records bigquery

i’m working on bigquery. I have two tables: one for sites and one for site logs. I want to make a query that selects all the sites (without duplicating them) and tells me the last status by date. I also want to know what answer team 1 or team 2 gave for each site. I do left join and duplicate everything, I already tried doing subqueries but it gives me an error. how can i solve it?

Table sites

table siteLogs

My query

what I hope to get

Advertisement

Answer

Try below

if applied to sample data in your question – output is

enter image description here

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