;with pos as ( select row_number() over(order by count(*)...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Ask Ubuntu Meta

Q&A about the site for Ubuntu users and developers

;with pos as
(
select row_number() over(order by count(*) desc) rank
     , count(*) [total positive questions]
     , tagname [postive tags]
from posts p
inner join posttags pt on pt.postid = p.id
inner join tags t on t.id = pt.tagid
where p.score > 0
group by tagname
)
,neg as
(
select row_number() over(order by count(*) desc) rank
     , count(*) [total negative questions]
     , tagname [negative tags]
from posts p
inner join posttags pt on pt.postid = p.id
inner join tags t on t.id = pt.tagid
where p.score < 0
group by tagname
)

select pos.*
     , neg.[total negative questions]
     , neg.[negative tags]
from pos
inner join neg on pos.rank = neg.rank
order by 1

Enter Parameters

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