DECLARE @UserID int = ##UserId## ;with top40 as ( select...


Please login or register to vote for this query.

(click on this box to dismiss)

Ask Ubuntu

Q&A for Ubuntu users and developers

DECLARE @UserID int = ##UserId##

;with top40 as (
  select top 40, t.tagname, count(pt.postid) K
  from tags t 
     inner join posttags pt
     on pt.tagid =
  group by t.tagname,
  order by count(pt.postid) desc
myanswers as(
  select p.parentid, p.score
  from posts p
    p.owneruserid =  @UserID  and
    p.communityowneddate is null

select t40.tagname as 'Tag', sum(p1.score) as 'Score',
case when sum(p1.score) >= 15 then ':-)' else ':-(' end as 'Status'
top40 t40 
INNER JOIN posttags pt1
ON pt1.tagid = 

LEFT JOIN  myanswers p1
ON pt1.postid = p1.parentid


group by t40.tagname, t40.K 
order by score, status asc

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results