0
点赞
收藏
分享

微信扫一扫

hive sql枞表横表互相转换

我是小小懒 2023-01-24 阅读 153

枞表转横表

select 
product_id
,max(case when field='test1' then 1 else 0 end) as test1
,max(case when field='test2' then 1 else 0 end) as test2
,max(case when field='test2' then 1 else 0 end) as test2
from
test_table_name
group by id

横表转枞表

主要是explode、split、concat_ws等方法组合使用

时间会记录下一切。



举报

相关推荐

0 条评论