我正在尝试将多个字段组合在一起并填充所需的列-NEED_X_TXT 输入数据:
CNVRS_ID CREAT_DT TY_ID TY_CD TM_LINE_CD
5801306 2019-06-06 9 NOI NOW
5801306 2019-06-06 27 NGU NOW
我已经在Impala中尝试了以下代码,但没有得到预期的结果。
select CNVRS_ID,creat_dt,
concat_ws('|',group_concat(TY_ID,'|'),group_concat(TY_CD,'|'),
group_concat(TM_LINE_CD,'|')) as
NEED_X_TXT
from events
group by cnvrs_id,creat_dt
预期结果:
CNVRS_ID CREAT_DT NEED_X_TXT
5801306 2019-06-06 9|NOI|NOW|27|NGU|NOW
实际结果:
CNVRS_ID CREAT_DT NEED_X_TXT
5801306 2019-06-06 9|27|NOI|NGU|NOW|NOW