现在有表:
想要将其合并为小明完整的一天:则
MySQL的实现方法:
SELECT name,GROUP_CONCAT(life ORDER BY id)
FROM table_test
hive 的实现方法:
select name,life
from
(SELECT name
, concat_ws('', collect_list(life) OVER (PARTITION BY belnr ORDER BY id)) AS life
,row_number()over(PARTITION BY name ORDER BY id desc )rn
FROM table_test
)a
where rn = 1
presto 实现的方法:
SELECT name, array_join(array_agg(life ORDER BY id),'')text
FROM table_test
GROUP BY name