我有这个查询,我需要转换为 DISTINCT,因为结果是双倍的 我该怎么做?
SELECT x.id_msg, x.id_group, x.profile_id, b.id_group, u.name, u.sirname, u.picup, u.profile_id AS profile_id_users, mp.msg_id,mp.msg_text, mp.occured_at
FROM message_view x
INNER JOIN (
SELECT a.id_msg, a.id_group, a.profile_id
FROM message_view a
WHERE a.profile_id = 'sN07X2'
)b ON x.id_group = b.id_group
INNER JOIN users u ON u.profile_id = x.profile_id
INNER JOIN message_private mp ON mp.msg_id = x.id_msg