不是Bigquery的存在

时间:2015-03-18 08:31:31

标签: google-bigquery

我想实现像

这样的东西
select * from table1
where not exists (select 1 from table2 where
                  table1.col1 = table2.col1 and table1.col2 = table2.col2)

我无法在BQ中实现这一点。 感谢任何有关完成此任务的帮助。

2 个答案:

答案 0 :(得分:4)

这样做的一种方法"关系减法" 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

答案 1 :(得分:-2)

使用" NOT IN"。来自我对https://stackoverflow.com/a/17408095/132438的评论:

SELECT top(state, 10), COUNT(*) 
FROM [publicdata:samples.natality]
WHERE state NOT IN ("TX", "CA"
相关问题