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
) 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
t;
这样写就行,厉害,谢谢~ 不过 这是为什么? bug 么