I have some join's and I am retrieving "tags" associated with a piece of content. I get my tags bag fine but they are duplicated like 6-7 times each.
SELECT
users.userName,
usersProfiles.avatarUrl,
usersProfiles.gender,
GROUP_CONCAT(contentComments.message SEPARATOR ', ') AS comments,
c.*,
GROUP_CONCAT(tagWords.tagWord SEPARATOR ', ') AS tags,
(SELECT COUNT(contentId) FROM platform.contentLikes WHERE contentId = 1213) as feedBackLikes
FROM platform.contents c
INNER JOIN platform.users ON users.userId = c.userId
INNER JOIN platform.usersProfiles ON usersProfiles.userId = c.userId
INNER JOIN platform.contentTags ON contentTags.contentId = c.contentId
INNER JOIN platform.tagWords ON contentTags.tagId = tagWords.tagId
INNER JOIN platform.contentComments ON contentComments.contentId = c.contentId
WHERE c.contentTitle = :contentTitle AND c.userId = :userId
Bu durumda ve neden olarak herhangi bir ipucu veya önerileri yanlış ise, nasıl ben bunu doğru şekilde yapıyor hakkında gitmek istiyorsunuz?
Teşekkürler!