--将项目中的总监,经理,等的邮箱合并为一行 SELECT GROUP_CONCAT(t.USER_EMAIL SEPARATOR ' ') mail_address FROM portal.t_acl_userinfo AS t WHERE t.username IN (SELECT DISTINCT a FROM ( SELECT * FROM ( SELECT XM_MANAGER a FROM xm_main WHERE xm_code='p20190132') A UNION ALL SELECT * FROM ( SELECT XM_CONTACT a FROM xm_main WHERE xm_code='p20190132') B UNION ALL SELECT * FROM ( SELECT XM_GENERAL a FROM xm_main WHERE xm_code='p20190132') C ) s)AND t.user_email IS NOT NULL
mysql