WITH post_tag_combinations AS( select pt.PostId, count(*)...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Open Source Meta

Q&A about the site for people organizing, marketing or licensing open source development projects

WITH post_tag_combinations AS(
select pt.PostId,
        count(*) tags_cnt,
   min(pt.TagId) min_tag,
   max(pt.TagId) max_tag,
   sum(pt.TagId) tags_is_sum
from PostTags pt
where exists(
select 1 from posts p where p.Id = pt.PostId)
group by pt.PostId
having count(*) > 1
)
select tags_cnt, min_tag, max_tag, tags_is_sum, count(*) combinations_cnt,
       t1.TagName, t2.TagName
from post_tag_combinations ptc
JOIN Tags t1 on t1.Id = ptc.min_tag
JOIN Tags t2 on t2.Id = ptc.max_tag
group by tags_cnt, min_tag, max_tag, tags_is_sum, t1.TagName, t2.TagName
order by count(*) desc;

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results