Home  >  Article  >  Database  >  hive union all嵌套使用

hive union all嵌套使用

WBOY
WBOYOriginal
2016-06-07 14:57:441498browse

不多说了,直接上代码 无 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
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn