Mysql Hive 通用的行列转换

就是简单的一个字符串拼接,意义和所用场景自己体会下

insert into table agent_library1 select concat_ws(':',collect_set(name)) as name,contact,concat_ws(':',collect_set(company)) as company,concat_ws(':',collect_set(stores))as stores,concat_ws(':',collect_set(city)) as city,concat_ws(':',collect_set(street)) as street from 
(select name,company,city,concat_ws(':',collect_set(contact)) as contact,concat_ws(':',collect_set(stores))as stores,concat_ws(':',collect_set(street)) as street from agent_character1 group by name,company,city)a group by a.contact;

 

posted on 2016-08-09 11:35  山高似水深  阅读(26475)  评论(0编辑  收藏  举报

购买方式 点击下面图标购买