欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

hive union all嵌套使用

程序员文章站 2022-06-01 14:23:56
...

不多说了,直接上代码 无 select id from (select a.id from (select 1 as id from duaunion all select 2 as id from dua) a join (select 4 as id from dua) f on a.id =f.idunion all select b.id from (select 1 as id from duaunion all select 2 as id

不多说了,直接上代码
select id from (
	select a.id from 
	(
	select 1 as id from dua
	union all 
	select 2 as id from dua
	) a join 
	(select 4 as id from dua) f on a.id =f.id
union all 
	select b.id from 
	(
	select 1 as id from dua
	union all 
	select 2 as id from dua
	) b join 
	(select 3 as id from dua) e on b.id =e.id
) c
select id from (
select a.id from 
(
select 1 as id from dua
union all 
select 2 as id from dua
union all
select 5 as id from dua
union all 
select 6 as id from dua
) a join 
(
select 4 as id from dua
 union all
select 3 as id from dua
) b on a.id =b.id
) c