这是我的查询:
SELECT DISTINCT star_user.name_user, star_group.name_group, star_addresses.email
FROM star_addresses
JOIN star_user_group
ON star_user_group.id_user_groupu = star_addresses.user_id
JOIN star_group
ON star_group.id_group = star_user_group.id_group_groupu
JOIN star_user
ON star_user.corespondence_user = star_addresses.id_address
JOIN star_news_group
ON star_news_group.groupid_newsg = star_user_group.id_group_groupu
WHERE newsid_newsg = 5;
运行上述查询后,我得到以下输出:
name_user|name_group|email
Zuma |A |abc@zz.com
Rafe |B |xyz@nn.com
Adam |D |aaa@bb.com
Zuma |B |abc@zz.com
Zuma |C |abc@zz.com
我希望拥有的不是 Zuma 的重复值,例如她的 name_user 和电子邮件:
name_user|name_group|email
Zuma |A,B,C |abc@zz.com
那么,如何获得呢?非常感谢您的帮助!