select top 10 Users.Id, count(distinct(Posts.Id)) as Post...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Amateur Radio Meta

Q&A about the site for amateur radio enthusiasts

select top 10
Users.Id,
count(distinct(Posts.Id)) as PostCount,
count(distinct(Comments.Id)) as CommentCount
from Users
join Posts on Posts.OwnerUserId = Users.Id
join Comments on Posts.id = Comments.PostId and Comments.UserId = Users.Id
where (year(Comments.CreationDate)>=year(getdate())-10) 
group by Users.Id
order by PostCount,CommentCount desc

Enter Parameters

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