【发布时间】:2021-09-28 23:33:00
【问题描述】:
我想删除表 t1 中存在于表 t2 中的所有行。
table_1 is as follows
a b c
1 4 3
3 334 3
5 4 5
6 5 4
4 85 3
7 332 54
8 46 6
45 42 5
7 576 6
表2如下
a b c
7 332 54
3 334 3
7 576 6
如前所述,我想删除表 t1 中存在于表 t2 中的所有行。
所以我使用了代码
DELETE `projectname.datasetname.table1` t
WHERE t IN (SELECT * from `projectname.datasetname.table2`)
但它不起作用,这里的理想解决方案是什么? 我想要的结果是
a b c
1 4 3
5 4 5
6 5 4
4 85 3
8 46 6
45 42 5
谢谢
【问题讨论】:
-
“没有帮助”是什么意思?样本数据和期望的结果也会有所帮助。
-
Table_1 有 10 行,而 table_2 有 3 行,Table_2 中的相同 3 行在 Table_1 中可用。我想从 Table_1 中删除这 3 行,以便我现在有 Table_1 有 7 行:没有帮助意味着代码不起作用
标签: sql google-bigquery google-cloud-functions bigquery-udf