Use 'DISTINCT' for BI Q20 Postgres implementation
@@ -19,7 +19,7 @@ WITH RECURSIVE tagclass_tree(root_tagclassid, root_tagclassname, tagclassid) AS
AND tt.tagclassid = tc.tc_subclassoftagclassid
)
SELECT tt.root_tagclassname AS "tagClass.name"
- , count(mt.pst_postid) AS messageCount
+ , count(DISTINCT mt.pst_postid) AS messageCount
FROM tagclass_tree tt INNER JOIN tag t ON (tt.tagclassid = t.t_tagclassid)
LEFT JOIN post_tag mt ON (t.t_tagid = mt.pst_tagid)
WHERE 1=1
