【问题标题】:Union in big query大查询中的联合
【发布时间】:2021-05-25 02:54:32
【问题描述】:

请问如何在 Big Query 中为 UNION 编写正确的查询。

例如, 表 A = 有一些列的数据类型不是字符串。

enter image description here

表 B = 上图中没有这样的列。

谁能帮忙写出正确的查询

【问题讨论】:

    标签: google-bigquery union-all


    【解决方案1】:

    尝试明确指定null 值:

    with table_a as (
      select 'from table a' as src, current_datetime() as datetime_column, 1.5 as float_column, 3 as integer_column
    ),
    table_b as (
      select 'from table b' as src
    )
    select * from table_a
    union all
    select src, null, null, null from table_b
    

    【讨论】:

      猜你喜欢
      • 2015-11-28
      • 1970-01-01
      • 2019-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多