Skip to content
Advertisement

How can I get the complement in this SQL query?

I have a bigquery database that has some latitude and longitude. Over this database, I run a query using CTE and the ST_COVERS bigquery function. The total sub-set is 518 rows and the points that apply to the CTE chain are 423. How can I get the remaining rows? I have tried to join, union all, left join, inner join, and other stuff, but I can’t get the total 518 rows.

PD: I’m not posting the query because it’s quite long (probably can be optimized a lot), but I can post it if it is really needed.

EDIT: This is the query (or most important parts of it). With this query, I can get all lat,lon points that are within some polygons. What I’m looking for is also to get the lat,lon points that are outside of all polygons and assign them a tag “NA” in the sector column.

Advertisement

Answer

Try below

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