Bigquery 中不存在

KRS*_*KRS 3 google-bigquery

我想实现类似的东西

select * from table1
where not exists (select 1 from table2 where
                  table1.col1 = table2.col1 and table1.col2 = table2.col2)
Run Code Online (Sandbox Code Playgroud)

我无法在 BQ 中实现这一点。对于完成这项工作的任何帮助,我们将不胜感激。

Mos*_*sky 5

在 BigQuery 中执行此类“关系减法”操作的一种方法是:

SELECT table1.* FROM table1 LEFT OUTER JOIN table2 
  ON  table1.col1 = table2.col1 AND table1.col2 = table2.col2
WHERE table2.col1 IS NULL AND table2.col2 IS NULL
Run Code Online (Sandbox Code Playgroud)