Query1:Select posts (Id) that have greater CommentCount than FavoriteCount with their corresponding

0

Please login or register to vote for this query.

(click on this box to dismiss)

Anime and Manga

Q&A for anime and manga fans

--Show the top 3 users (Id) for each month (January-December), 
--by total ViewCount (for all user posts). Include DisplayName and each user’s ranking within the month

with cte1 as (
select 
month(p.CreationDate) mm,
u.id,
u.DisplayName name,
sum(ViewCount) total,
rank()over(partition by month(p.CreationDate) order by sum(ViewCount) desc) rnk

from users u
join Posts p
on u.id=p.OwnerUserId
group by month(p.CreationDate),u.id,u.DisplayName )

select distinct 
mm,
name,
rnk
from 
cte1 
where rnk<=3

Enter Parameters

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