Q&A for students, teachers, and linguists wanting to discuss the finer points of the Russian language
/*decile of posts count by user_id select userid, ntile(10) over (order by no_posts) from (select top(100) userid, count(postid) as 'no_posts' from comments where year(creationdate) = 2021 group by userid order by count(creationdate) desc) a */ select top (50) a.userid, max(a.creationdate) as 'last_post', b.text from comments a join comments b on a.userid = b.userid and a.creationdate = b.creationdate group by a.userid, b.text