我想从多行到单行选择电子邮件地址
查询:
SELECT p.email_addr||';' Email_Address
FROM pa_user_prfl p, pa_user_prfl_role r
WHERE p.user_name = r.user_name
AND dmn_id = 'PGM-GRANGE CASTLE'
AND role_id LIKE 'Site/Area%';
答案 0 :(得分:0)
您想要选择一个字符串,其中包含用分号分隔的所有电子邮件地址吗?请使用GROUP_CONCAT
:
SELECT group_concat(p.email_addr separator ';') as Email_Addresses
FROM pa_user_prfl p
JOIN pa_user_prfl_role r ON p.user_name = r.user_name
WHERE dmn_id = 'PGM-GRANGE CASTLE'
AND role_id LIKE 'Site/Area%';