大查询中的联合

问题描述

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

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

enter image description here

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

谁能帮忙写出正确的查询

解决方法

尝试明确指定 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 from table_b

enter image description here