本文介绍了像操作员一样的蜂巢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[在此输入链接描述] [1]

[enter link description here][1]

表1:

品牌
索尼
苹果
Google
IBM

BRAND
Sony
Apple
Google
IBM
etc.

表2:

hive> select * from PRODUCT;    
SonyABC,Applepqr       101
Sonyadvv,IBMabc        102
Sonyaaaa               103
Apple123,Sonyxyz       104
Apple345,IBMabc        105
IBM13123SonyABC        106   
My data is like above.and i need output like bellow.Please suggest a query

SonyABC,Applepqr         101     Sony,Apple
Sonyadvv,IBMabc          102     Sony,IBM
Sonyaaaa                 103     Sony
Apple123,Sonyxyz         104     Apple,Sony
Apple345,IBMabc          105     Apple,IBM
IBM13123,SonyABC         106     IBM,Sony

推荐答案

可能是您数据中的某些问题,但这如下所示蜂巢>从品牌中选择*;了索尼苹果谷歌IBM

May be some issue in your data, but this works as following hive> select * from BRAND; Sony Apple Google IBM

hive> select * from PRODUCT;    
SonyABC 101
Sonyadvv        102
Sonyaaaa        103
Apple123        104
Apple345        105
IBM13123        106

select PRODUCT.*, BRAND.*  from BRAND, PRODUCT where trim(PRODUCT_ID) like  concat(trim(BRAND_ID),'%');


SonyABC         101     Sony
Sonyadvv        102     Sony
Sonyaaaa        103     Sony
Apple123        104     Apple
Apple345        105     Apple
IBM13123        106     IBM
Time taken: 11.381 seconds, Fetched: 6 row(s)

这篇关于像操作员一样的蜂巢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 07:11