Q&A for professional and enthusiast programmers
select p.ViewCount / 1000 as [kViews], -- count(*) as [Post count], -- sum(p.CommentCount) as [Total comment count], sum(p.CommentCount) / count(*) as [Average comment count] from Posts p where p.CommentCount != 0 group by p.ViewCount / 1000 order by p.ViewCount / 1000