hive实现两列数据合并成一列

hive中源表数据:
name(string) gender(String)

lcl        nan
haa     nan
ddd     nv

实现如下结果:

lcl
nan
haa
nan
ddd
nv

hql中使用union all 即可实现:

select name from tab1 union all select gender as name from tab1;

表数据:

hql:

查询结果:

在Mysql中直接使用union all  ,用相同的sql语句不能实现:

发布了19 篇原创文章 · 获赞 4 · 访问量 17万+

猜你喜欢

转载自blog.csdn.net/u011250186/article/details/105563544