简体   繁体   English

在 Bigquery 中连接多个表

[英]Join multiple tables in Bigquery

I have over 100 tables in my BQ, but i would like to create a single table with all the tables.我的 BQ 中有 100 多个表,但我想创建一个包含所有表的表。

How is this possible?这怎么可能? Now i am using the below query to export data manually by table.现在我使用以下查询按表手动导出数据。

SELECT 
date as Date,
SUM(totals.visits) as TotalVisits
From
[1243.ga_sessions_20160425]
Group by date
order by date

I also would like to add alias to each table so that i would know from which table the data came from.我还想为每个表添加别名,以便我知道数据来自哪个表。

please let me know thanks请让我知道,谢谢

The way to union tables in BQ is by using table wildcard functions.在 BQ 中联合表的方法是使用表通配符函数。 your query should look something like: (If you share your data-set, we can verify the suggested query)您的查询应该类似于:(如果您共享数据集,我们可以验证建议的查询)

SELECT 
    date as Date,
    SUM(totals.visits) as TotalVisits
    From
    TABLE_QUERY(1243,'table_id contains"ga_sessions_"')
    Group by date
    order by date

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM