我所拥有的是3个表,一个是巨大的表,另一个是我需要查询行的参考。
例如:
Table1: Table2: Table3:
|value|num| |value| |value|
| AAA | 2 | | AAA | | BBB |
| BBB | 6 | | CCC | | EEE |
| CCC | 3 |
| DDD | 7 |
| EEE | 1 |
它应该返回:
|value|num|
| AAA | 2 |
| BBB | 6 |
| CCC | 3 |
| EEE | 1 |
我需要做的是我需要做的是:
Select *
from [table1] as A
join [table2] as B
on A.value=B.value
join [table3] as C
on A.value=C.value
我正在与Bigquery合作,我不知道我是否有任何限制。
提前谢谢。
答案 0 :(得分:2)
我认为你很亲密。但看起来你想要一个UNION
Select *
from [table1] as A
join [table2] as B
on A.value=B.value
UNION
Select *
from [table1] as A
join [table3] as C
on A.value=C.value
修改强>
看起来像bigquery不支持UNION但是有这个解决方法。
SELECT * FROM (query 1), (query 2);
它的作用与:
相同SELECT * from query1 UNION select * from query 2