【问题标题】:join 3 annual tables by showing the year data通过显示年份数据加入 3 个年度表
【发布时间】:2022-11-23 03:11:04
【问题描述】:

我想制作三个年度表格的组合表格,其中表格将显示类别(油漆)、年份和总收入。

我之前合并了三个表,但没有输出数据,即使没有报错

三个表的结构相同,只是日期不同

冷表将包含该项目

cat_name
extract year from payment_datetime
total_revenue from GMV(price*product_quantity)*Percentage_comission

【问题讨论】:

标签: sql google-bigquery


【解决方案1】:

如果它们的结构相同,您可以将所有表放在一起union

select
cat_name,
year,
total_revenue
from table_1
union all
select
cat_name,
year,
total_revenue
from table_2
union all
select
cat_name,
year,
total_revenue
from table_3

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-05-22
    • 1970-01-01
    相关资源
    最近更新 更多