mysql 多行数据合并一行 GROUP_CONCAT
2020-01-02 本文已影响0人
爱吃苹果的西瓜
group_concat
SELECT
t.application_id,
t.submit_by,
t.dept_code,
t.create_time,
t.complete_time,
t.`process_id`,
t_hi_new.assignee
FROM
t_application_info t
LEFT JOIN
(SELECT
t_hi.`PROC_INST_ID_` AS process_id,
GROUP_CONCAT(CONCAT(t_hi.`ASSIGNEE_`)) AS assignee
FROM
act_hi_taskinst t_hi
GROUP BY PROC_INST_ID_) t_hi_new
ON t.`process_id` = t_hi_new.process_id
WHERE t.`application_type` IN ('50603')
AND UNIX_TIMESTAMP(t.create_time) > UNIX_TIMESTAMP('2019-01-01 00:00:00')
AND UNIX_TIMESTAMP(t.complete_time) < UNIX_TIMESTAMP('2019-12-31 23:59:59') ;