WITH t
AS (
SELECT
COALESCE(b.role_id,a.role_id) role_id
,COALESCE(b.role_name,a.role_name) role_name
FROM pre_dim.dim_performance_roster_month
a
LEFT JOIN pre_dim.dim_performance_roster_month
b ON a.user_id = b.user_id
) a1
SELECT
GROUP_CONCAT(DISTINCT role_id
ORDER BY role_id
ASC SEPARATOR ‘&&’ ) role_ids,
GROUP_CONCAT(DISTINCT role_name
ORDER BY role_id
ASC SEPARATOR ‘&&’ ) role_names
FROM a1;
好像确认有这个问题,这样写就没问题