with PostCounts as ( select Tags.Id as TagId, co...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Sustainable Living

Q&A for folks dedicated to a lifestyle that can be maintained indefinitely without depleting available resources

-- Enter Query Title
-- Enter Query Description

with
PostCounts as (
  select
     Tags.Id         as TagId,
     count(Posts.Id) as PostCount
  from Posts    inner join
       PostTags on Posts.Id = PostTags.PostId
                inner join
       Tags     on PostTags.TagId = Tags.Id
  group by Tags.Id
),
Variants as (
  select *
  from (select replace(TagName, 'ou', 'o') as vname, * from tags) as r
  where vname != tagname
)

select
  Tags.TagName,
  tc.PostCount,
  Variants.TagName,
  vc.PostCount
from
  Tags          inner join
  Variants      on Tags.tagName = Variants.vname
                inner join 
  PostCounts tc on Tags.Id = tc.TagId
                inner join
  PostCounts vc on Variants.Id = vc.TagId
;

Enter Parameters

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