SELECT concepts.*,
string_agg(DISTINCT concept_skill, ', ') AS skillsSortedById,
COUNT (likes.concept_id) AS counted
FROM concepts
INNER JOIN concept_skills ON
(concepts.concept_id=concept_skills.concept_id)
INNER JOIN likes ON (concepts.concept_id=likes.concept_id)
GROUP BY concept_skills.concept_id, concepts.concept_id
ORDER BY counted desc;
以某种方式,当使用string_agg
次计数时,使用计数乘以4并得出错误的结果,但如果我使用不带string_agg
的计数,则会给出确切的结果,任何人都可以帮助解决这个原因?