union all的用法,其实不陌生的。union all上下的字段名要一致,字段数据类型要一致。但是满足上面两点后还是报错(doris 可以正常查询,但是当把下面这段sql做成逻辑视图时,就会报错)。报错sql如下
with a as (select * from t1),
b as (select * from t2)
select *
from a
union all
select *
from b
后面发现,原来是doris不支持顶层查询,换句话说,换成下面的代码就可以了
with a as (select * from t1),
b as (select * from t2)
select *
from (select *
from a
union all
select *
from b) c
4万+

被折叠的 条评论
为什么被折叠?



