一、需求说明
- 今天工作当中需要对一个清单表中所列取的数据进行在hive指定表进行相应列的模糊匹配,来最终查询出表中是否存在该值。
二、案例实操
- 首先阐述一下本次所要用到的Hive SQL语法关键字…
select * from table where 字段 regexp 'key1|key2';
- 具体SQL代码实现
select distinct cell_key
from dwd_db.dwd_lbs_4g_anal_real
where day_id = 20211229
and province_code = 130000
and cell_key regexp
'164151|576651|164294|577086|164929|164093|576599|165801|164394|577156|165873|164160|576670|164484|164199|164176|576685|164212|576773|164214|576786|576791|164195|576707|164538|164480|164182|576686|164213|576774|164151|576651|164294|577086|164929|164093|576599|164160|576670|164484|164199|164176|576685|164212|576773|164214|576786|576791|164195|576707|164538|164480|164182|576686|166580|164213|576774|164189|576689|164467|164151|576651|164294|577086|164929|164093|576599|165801|164394|577156|165873|164160|576670|164484|164199|164176|576685|164212|576773|164214|576786|164872|577388|576791|164195|576707|166635|577490|164538|164962|164480|164182|576686|164211|576752|164213|576774|164189|576689|164467|164482|164492';
执行返回结果如截图所示: