行转列和列转行

行转列
select t.cb , concat_ws ( "|" , collect_set ( t.name ) )
from
( select concat(constellation , "," blood_type ) cb , name frome person_info) t group by t.cb


列转行
select movie, category
from move_info
lateral view explode(category) a as category

你可能感兴趣的:(行转列和列转行)