Posts

Showing posts with the label legacy-sql

Multiple Left Joins in BigQuery

Multiple Left Joins in BigQuery I'm trying to make a currently working SQL query that I have in BigQuery more streamlines and am running into the following issue: Error: ON clause must be AND of = comparisons of one field name from each table, with all field names prefixed with table name. Consider using Standard SQL .google.com/bigquery/docs/reference/standard-sql/), which allows non-equality JOINs and comparisons involving expressions and residual predicates. Below is the query that is giving the error above. The first LEFT JOIN works. When I added the second one, right below, I started getting the error. What I'm trying to do is get the human readable own.o.firstname and own.o.lastname values rather than the owner_id value of the deal record (o.properties.hubspot_owner_id.value), but in order to do so I need to join some tables. I had to use CAST on the ON clause of the second JOIN because the fields are of different types in each table's respective schema. If I don'...